What happened? I DIDN’T CHANGE THE CODE.
ERROR: the index ‘0’ does not exist result
ERROR: at ShowTemperature:12
const i2c_temp = 0x92;
local i2c = hardware.i2c89;
local result = i2c.read(i2c_temp, “\x00”, 2);
local t = ((result << 4) + (result >> 4)) /16.0
if (result>128) t-=256;
t = t * 9 / 5 + 32;
local tString = (format(“Temp: %.2f”,sum) + “°F” );
it looks like the sensor is not responding.
Have you tried to run the test procedure?
Problem solved? I power cycled it twice with no change. I pressed Run a number of times while experimenting with the code, commenting out lines. Put the code back the way it was. Removed it from the refrigerator. It had been in there for days. Now it works perfectly! Imps don’t like the cold?
@Dimitri- Has anyone written some simple code for the RGB light sensor? How about the Accellerometer?
This problem began when the router crashed. When I fixed it, the Imp never came back, I waited for hours. Why not?
I noticed, when something is going wrong with Hannah and you have to power cycle, give it a couple of minutes. Hannah keeps remembering register values very long
@sbright33 the index not existing error most likely means that the i2c transaction didn’t complete - you aren’t checking the transaction succeeded before trying to look at the result.
As has been noted in other threads, the issue with not reconnecting is related to release 25’s new offline modes (sometimes it determines it’s happy with not being connected). Peter’s watchdog code addresses this, as will the release which we’re currently testing with several developers.