General area when it fits no where else

Moderator: Mmiscool

User avatar
By AHMET YILMAZ UCAN
#48037 Hi All
I used esp8266-01 my project my procets has tow ds18b20 sensor and connect gpio2 and connect one relay gpio0
but esp run a few hour after it is freeze (I thing that so) no any answer
my Code
Code: Select all'http://192.168.4.1/msg?stat=1&action=temp
po 0 1
Timer 1000, [tick]
msgbranch [mybranch]
wait

[mybranch]
'MyReturnMsg = "Not a valid msg received"
msgget "stat" pinStatus
msgget "action" pinAction

if pinAction == "temp"    then gosub [send.temp]
msgreturn MyReturnMsg
wait

[tick]
let a = a + 1
if a > 100 then po 0 1
wait

[send.temp]
cls
let a = 0
let cura = 0
temp 0 cura

let curb = 0
temp 1 curb
let cura = floor(cura) 'in temp
let curb = floor(curb) 'out temp

if cura > 75 then po 0 1 'kapat
let a = 0
let mess = ""
'let mess = mess & "{"
'let mess=mess & chr(34)
'let mess=mess & "data"
'let mess=mess & chr(34)
'let mess=mess & ":"
let mess = mess & "{"
let mess = mess & Chr(34)
let mess = mess & "temp_in"
let mess = mess & Chr(34)
let mess = mess & ":"
let mess = mess & Chr(34)
let mess = mess & cura
let mess = mess & Chr(34)
let mess = mess & ","
let mess = mess & Chr(34)
let mess = mess & "temp_out"
let mess = mess & Chr(34)
let mess = mess & ":"
let mess = mess & Chr(34)
let mess = mess & curb
let mess = mess & Chr(34)
let mess = mess & "}"
po 0 pinStatus
MyReturnMsg = mess
let a = 0
Return




I dint solved do you have any idea ?
regards
Ahmet from TURKEY/Istanbul
User avatar
By Electroguard
#48061 Hi Ahmet,
I do not understand your code or what you are trying to achieve, but if it is doing what you want it to do for a few hours, then I suggest you pay attention to your [tick] subroutine, because you seem to be eternally incrementing your 'a' variable which will eventually 'max out'.

Try periodically resetting your 'a' variable to prevent it growing too big...

[tick]
if a > 100 then
let a = 0
po 0 1
endif
wait[
User avatar
By AHMET YILMAZ UCAN
#48066 thank for answer
ok I want to control my home heater system for android tablen on wifi
two sensor there are one measure boiler water other sensor measure out air temperature
my tablet send request every 10 sec. for temperature from esp

all system work 24 hours ( all time) but esp code give answer a few hour after my tablet give error "specific url not response......"

I dint understant and didnt solved ...

I will try let a=0 yep it is my mistake

I hope I was able to explain