Page 1 of 1

count up a variable

Posted: 19 Oct 2019, 21:15
by ingoiot
hi i'm trying to count up /down a value that i initialized at boot, with two buttons.

Code: Select all

On System#Boot do    //When the ESP boots, do

//[DummyVar#TempSetpoint]=40
TaskValueSet 3,1,40

endon


on ButtonLeft#state=0 do

//[DummyVar#TempSetpoint]-
TaskValueSet 3,1,-1

endon

on ButtonRight#state=0 do

//[DummyVar#TempSetpoint]+
TaskValueSet 3,1,+1

endon
i wanted this value to be set at boot or later with a http send via an app,
and increase/decrease it locally via Buttons.

it gets set at boot to 40 like i want but unfortunately,
when i press a button its set to 1 or -1 not to 41,42,43 and so on.

Re: count up a variable

Posted: 19 Oct 2019, 21:25
by Domosapiens
You need to mention the name of your variable [DummyVar#TempSetpoint] and operate on the content, therefor the []

Code: Select all

On System#Boot do    //When the ESP boots, do

//[DummyVar#TempSetpoint]=40
TaskValueSet 3,1,40

endon


on ButtonLeft#state=0 do

//[DummyVar#TempSetpoint]-
TaskValueSet 3,1,[DummyVar#TempSetpoint]-1

endon

on ButtonRight#state=0 do

//[DummyVar#TempSetpoint]+
TaskValueSet 3,1,[DummyVar#TempSetpoint]+1

endon
I think this will work.

Re: count up a variable

Posted: 19 Oct 2019, 21:41
by ingoiot
I think this will work.
indeed it did , tnx.