13.06.2020, 02:45
(This post was last modified: 13.06.2020, 05:16 by phongvucba.)
Thank so much ! Everyone !
But I want an address to reset. For example, the address 1/1/1 1byte (it's from 0-255). I want if in 10s it has no activity, it will reset 1/1/1 = 0, and if less than 10s it has an impact then it will count from the last impact. Like the sensor, it turns off every 10 seconds if there is no motion.
---------------
(In other words I mean)
Alternatively, my Delay command (os.delay) is repeated every time I change the value. I don't want that, I just want the Delay command to work for the first time.
For example:
grp.write ('1/1/1', true)
os.sleep (10)
grp.write ('1/1/1', false)
----------------
Then in about 10 seconds, I press the address 1/1/1 4 times, then my Delay command was repeated 4 times, and it made the value of 1/1/1 = fasle repeat 4 times. I don't want that, I just need it to work for the first time(1/1/1 = fasle repeat 0 times).
I was thinking Delay just paused the command line to execute. It then executes again after the set number of seconds. Leads to 1/1/1 = false repetition. I tried os.kill and return. but not work.
Thanks everyone !
thank all!
But I want an address to reset. For example, the address 1/1/1 1byte (it's from 0-255). I want if in 10s it has no activity, it will reset 1/1/1 = 0, and if less than 10s it has an impact then it will count from the last impact. Like the sensor, it turns off every 10 seconds if there is no motion.
---------------
(In other words I mean)
Alternatively, my Delay command (os.delay) is repeated every time I change the value. I don't want that, I just want the Delay command to work for the first time.
For example:
grp.write ('1/1/1', true)
os.sleep (10)
grp.write ('1/1/1', false)
----------------
Then in about 10 seconds, I press the address 1/1/1 4 times, then my Delay command was repeated 4 times, and it made the value of 1/1/1 = fasle repeat 4 times. I don't want that, I just need it to work for the first time(1/1/1 = fasle repeat 0 times).
I was thinking Delay just paused the command line to execute. It then executes again after the set number of seconds. Leads to 1/1/1 = false repetition. I tried os.kill and return. but not work.
Thanks everyone !
thank all!