Page 1 of 1

Hold button for set time to enter a routine

Posted: Tue Oct 04, 2022 4:55 pm
by Maverick
Hi
I'm trying to detect that if a button is pressed for >=to 5s a calibration routine will run and then goto normal mode. if the button is released before the 5s then normal mode is run. due to other hardware the push button needs to be on port E1. Attached is a test fcfx attempt which doesn't work. Pleased advise if there is a solution either with the attached fcfx or another

Re: Hold button for set time to enter a routine

Posted: Tue Oct 04, 2022 8:59 pm
by medelec35
Hello
The reason you are having an issue is that if using a switch set to Active low and using the ReadState()
Then if the switch is pressed the ReadState() value will be true (1).
This will be the same as the pin voltage at 0v on your hardware.
If you want the simulation value to be false (0) then instead of using ReadState() you will need to use an input command icon.
I have attached an example using ReadState() macro function that should work with the simulator and on hardware.

Re: Hold button for set time to enter a routine

Posted: Wed Oct 05, 2022 9:40 am
by Maverick
Hi Martin

Thanks for that prompt and excellent solution