Hi my imp seems to be unable to receive any download. It always hangs on devicebooting after download. Is there a bug in my program or is my imp spoilt?
Device ID: 235b443643fc42ee
Hi my imp seems to be unable to receive any download. It always hangs on devicebooting after download. Is there a bug in my program or is my imp spoilt?
Device ID: 235b443643fc42ee
Hi, this is my program but it cannot compile, after this 1 line of day_compensation++
imp.configure(“softoverride”,[],[]);
local current_status=“OFF”;
local day_status=[null];
local day_status_index=-1;
day_status.clear();
day_status.resize(14,“NIL”);
local preset_timer=-1;
local schedule_timer=[null];
local schedule_timer_index=-1;
schedule_timer.clear();
schedule_timer.resize(14,-1);
local timezoneh=8;
local timezonem=0;
local day_compensation=-1;
local current_sec=-1;
hardware.pin5.configure(DIGITAL_OUT);
hardware.pin1.configure(ANALOG_IN);
function getCurrentDayDetails()
{
day_compensation=date().wday;
local hour_compensation=date().hour+timezoneh;
local min_compensation=date().min+timezonem;
if (minute_compensation >=60)
{
hour_compensation++;
minute_compensation-=60;
}
else if (minute_compensation <0)
{
hour_compensation–;
minute_compensation+=60;
}
day_compensation++
}
missing semicolon?
Semi-colons are optional.
The code appears to compile fine for me (almost - you have “
” on the 6th last line of the code, but I assume that’s a copy/paste error?
What do you mean by “it always hangs on device booting after download”?
Is it intentional to use day_compensation outside the function and inside the function as well? Not the same thing, because you made it local.
Try changing this: local day_compensation=-1;
To this: day_compensation <- -1;
And you must not be showing the whole program, as you are never calling the function?
This forum editor sucks so bad … ignore the ‘br’ if it shows-up on your browser.
The forum editor is slightly de-sucked if you always put code in “code” tags (using the “C” button in the editor).
Peter
Thanks guys i will figure it out later
oh and i needed my day_compensation to be a global variable what will be a better way to do so?