ERROR: the index '0' does not exist

What happened? I DIDN’T CHANGE THE CODE.

ERROR: the index ‘0’ does not exist result[0]
ERROR: at ShowTemperature:12

const i2c_temp = 0x92;
local i2c = hardware.i2c89;
local was=999,ti=0;

function ShowTemperature(){
local i,sum=0;

local result =, “\x00”, 2);
local t = ((result[0] << 4) + (result[1] >> 4)) /16.0
if (result[0]>128) t-=256;
t = t * 9 / 5 + 32;
local tString = (format(“Temp: %.2f”,sum) + “°F” );
if((sum>was+1)&&(time()-ti>5*60)) {


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.