Start a new topic

help - ON - OFF Button and change txt content value

 Hi,


please help;

   with a button, when is pressed once, I send a value via serial, and when is pressed again, another value - like on/off; this work nice.

 In the same time, I need to change text box content when is pressed once , I need to write on t0.txt content value "1" . when is pressed second time txt value I need to be "0"
 I try it with timer, and a variable but without success .


place Variable va0 on page with button


in Button's Touch Pressed Event

va0.val=va0.val+1

va0.val=va0.val%2

cov va0.val,t0.txt,0

if(va0.val=1)

{

// this section handle if button value 1

printh 01

}else

{

// this section handle if button value 0

printh 00

}


1 person likes this

 thank you again Patrick Martin,


your code work now as I expected, 

it was an error but, after some time of search and learn :)  all is ok now

one "=" missed

still not get what %2 do it (mean) ..
 two number variation?

Login or Signup to post a comment