Hello, I am new to Imp development. I just received my Imp last night. I was trying to do a simple thermistor read using calibration curves I had developed using an Arduino. A thermistor is basically a temperature dependent resistor. Therefore I am reading the voltage divide between it and a 10k resistor. Using a multimeter on pin1, my hardware is working exactly as it should. The Imp is reading ~5200 ADC and is not changing with changing temperature/voltage. Can anyone tell me what I am doing wrong? Here is my code:
`// Read a thermistor and convert to temperature example
local output = OutputPort(“Temperature”, “number”);
function ThermistorCalc(rawADC)
{
if(rawADC > 0)
{
local Rthermistor;
local Rln;
local temperature;
local A = 0.00009828;
local B = -0.00253126;
local C = 0.02274547;
local D = -0.06718690;
Rthermistor = ((65535 * 10000 / rawADC) - 10000);
Rln = math.log(Rthermistor);
temperature = 1 / (Amath.pow(Rln,3) + Bmath.pow(Rln,2) + C*Rln + D);
return temperature;
} else {
return 0;
}
}
function loop()
{
imp.wakeup(30,loop);
local temperature = ThermistorCalc(hardware.pin1.read());
server.log(hardware.pin1.read());
server.show(“Turkey: “+format(”%3.1fF”, temperature));
output.set(format("%3.1f", temperature));
}
hardware.pin1.configure(ANALOG_IN);
imp.configure(“Thermistor Read 1”,[],[output]);
loop();`