I am using an analog anemometer on the analog input of an ESP8266.
I store the maximum wind value (gust) in a variable (var2).
But my code doesn't work because the variable doesn't seem persistent.
Here is my code :
Code: Select all
On System#Boot do
let,1,0 // [var#1]= speed ms
let,2,0 // [var#2]= max speed ms
timerSet,1,10 // send every 10s
endon
On Vent_analog#analog do
// store speed value ms in var#1
let,1,[Vent_analog#analog]*30/1024
if [var#1]>[var#2] // store max speed in var#2
let,2,[var#1]
endif
endon
On Rules#Timer=1 do // 10s
// send max speed
SendToHTTP 192.168.1.30,8080,/json.htm?type=command¶m=udevice&idx=59&nvalue=0&svalue=[var#2]
timerSet,1,10
endon
Thanks for your help.