I have write a program in which a tactical switch is used for device ON and OFF.
On long pressed (300uSec) device will get ON from deep Sleep and goes into the deep sleep same button for (1.5Sec). In this case my device get immediately gets on/OFF means its toggle continuously .So,I want it should work like mobile phone(when on long pressed mobile get turned on and to turn off we need to press it again after releasing it.)
I want a second functionality with same button is to be in a mode where i can select the other functionality available in device like it should go in configuration mode where it have different function call like connect to WiFi, connect to Bluetooth etc. using that single button it moves forward like we have it in some digital watch where we can select multiple functions using single button.
LONG PRESS 35 MILLISEC___> DEVICE GET ON
LONG PRESS 1.5SEC___> DEVICE GET OFF
ON DOUBLE TAP >>> IT ENTERS IN CONFIGUIRATION MODE
1> SCAN WIFI
2>CONNECT TO WIFI
3>SCAN BLUETOOTH DEVICE
4>CONNECT TO BLE DEVICE
AFTER DOUBLE TAP IT SHOULD MOVE TO 4 FUNCTIONALITY BUT BY PRESSING BUTTON IT SHOULD MOVES OR INCREMENT ONE AFTER ONE
Please check my code in attachment, and please guide me accordingly.
Please understand my mistakes.
MAIN_2click_wakeup.ino (5.44 KB)