Page 1 of 1

Switch GPIOx on GPIOy behaviour

Posted: 04 Sep 2021, 08:59
by njordan
Hi,
can someone please help me to find a rule (if possible at all) that only turns on GPIOx for 5sec if GPIOy has been pressed two times in a row....so two positive slopes within a certain time....like within 2secs....
I know its rather specific but i hope that i can use espeasy and still support this task. Many thanks...my starting point is the rule i found in the forum but this is far from the intended action. Thanks a lot for your support, NORBERT

on Button#Value do
if [Button#Value] = 1
EXTGPIO,16,1
else
EXTGPIO,16,0
endif
endon

Re: Switch GPIOx on GPIOy behaviour

Posted: 04 Sep 2021, 16:12
by TD-er
The switch plugin also allows to detect a doubleclick.
It will then generate an event with a different event value (have to look into the code, but I think it was event value 11)

So it will be something like this: (assuming the switch task is named "button" and the task value is "switch")

Code: Select all

on button#switch=11 do
  timerSet,1,5 // Set timer 1 to 5 seconds
  gpio,16,1
endon

	
on Rules#Timer=1 do
 GPIO,16,0
endon