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
Hold button for set time to enter a routine
-
- Posts: 68
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 02, 2020 10:58 am
- Has thanked: 27 times
- Been thanked: 8 times
Hold button for set time to enter a routine
- Attachments
-
- CALIBRATION_ENTRY_TEST_1.fcfx
- (21.36 KiB) Downloaded 46 times
-
- Matrix Staff
- Posts: 1457
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 513 times
- Been thanked: 473 times
Re: Hold button for set time to enter a routine
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.
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.
- Attachments
-
- CALIBRATION_ENTRY_TEST_1.fcfx
- (28.64 KiB) Downloaded 49 times
Martin