Sorry, this is the error:
In file included from ../inc/spark_wiring.h:29:0,
from ../inc/application.h:29,
from lmt871.cpp:1:
../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]
#warning "Defaulting to Release Build"
^
In file included from ../inc/spark_wiring.h:29:0,
from ../inc/application.h:29,
from playground.cpp:2:
../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]
#warning "Defaulting to Release Build"
^
playground.o:(.bss+0x10): multiple definition of `mVinf'
lmt871.o:(.bss+0x4): first defined here
playground.o:(.bss+0x14): multiple definition of `mVsup'
lmt871.o:(.bss+0x0): first defined here
playground.o:(.data+0x1c): multiple definition of `mV'
lmt871.o:(.data+0x4): first defined here
playground.o:(.data+0x110): multiple definition of `arrayDim'
lmt871.o:(.data+0x0): first defined here
collect2: error: ld returned 1 exit status
make: *** [86478ad9583bbedc1252ae91d73a2f6cb278580cf813a1e653d4d6ffe1d0.elf] Error 1
That one is the .h code:
#include "application.h"
#ifndef LMT871_H
#define LMT871_H
int arrayDim = 61;
int mV[]={
2767,2754,2740,2727,2714,2700,2687,2674,
2660,2647,2633,2620,2607,2593,2580,2567,
2553,2540,2527,2513,2500,2486,2473,2459,
2446,2433,2419,2406,2392,2379,2365,2352,
2338,2325,2311,2298,2285,2271,2258,2244,
2231,2217,2204,2190,2176,2163,2149,2136,
2122,2108,2095,2081,2067,2054,2040,2026,
2012,1999,1985,1971,1958};
int mVsup, mVinf;
double getTemp(int millis);
#endif
and the .cpp one:
#include "application.h"
#include "lmt871.h"
double getTemp(int millis){
double temp = 0;
for (int i = 0; i <= arrayDim; i++) {
if (millis <= mV[i]) {
temp = i - 10;
mVsup = mV[i];
mVinf = mV[i-1];
}
}
double decimal = (millis-mVinf) / ((mVsup - mVinf)/10);
temp += decimal;
return temp;
}
playground.ino is basically a tinker firmware with
#include "application.h"
#include "lmt871.h"
and a call to getTemp().