Want to turn off my program
-
- Posts: 8
- http://meble-kuchenne.info.pl
- Joined: Wed Oct 26, 2022 10:21 am
- Has thanked: 1 time
Want to turn off my program
I have this porgram attached and once i start the first option using my switch, i want to be able to turn it off during the first count. You can see my attempt in the counter30 macro, but i only get the input a couple times. As in i cant consistently get my input to work, as sometimes when i push the button the failsafe macro runs, sometimes it doesnt. Any help is appreciated
- Attachments
-
- exam tester 1.fcfx
- (27.02 KiB) Downloaded 74 times
Re: Want to turn off my program
Hi,
I am a bit puzzled as to what is going on, perhaps a couple of comments in your code might help.
I have changed the switch to a decision which allows the failsafe macro to run if button 7 is pressed while it is counting. Bob
I am a bit puzzled as to what is going on, perhaps a couple of comments in your code might help.
I have changed the switch to a decision which allows the failsafe macro to run if button 7 is pressed while it is counting. Bob
-
- Valued Contributor
- Posts: 1528
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 353 times
- Been thanked: 549 times
Re: Want to turn off my program
Hi 803772
The BL0145 module is not a bank of switches, they are push buttons.
Your program will only detect if any button is pressed if it reads the module whilst a button is actually pressed. In your Main loop you are polling pretty much all the time so it will catch any press and branch.
However when you branch to Counter15 you are looping and in each loop there is a delay of 500mS. Therefore you would need to press and hold the "Failsafe" button for at least 500mS to guarantee it will be read.
Do note that the module doesn't provide debounce, you may need to incorporate such in software.
Counter30 only appears to be a loop that doesn't do anything other than delay for around 15 seconds.
Regards
The BL0145 module is not a bank of switches, they are push buttons.
Your program will only detect if any button is pressed if it reads the module whilst a button is actually pressed. In your Main loop you are polling pretty much all the time so it will catch any press and branch.
However when you branch to Counter15 you are looping and in each loop there is a delay of 500mS. Therefore you would need to press and hold the "Failsafe" button for at least 500mS to guarantee it will be read.
Do note that the module doesn't provide debounce, you may need to incorporate such in software.
Counter30 only appears to be a loop that doesn't do anything other than delay for around 15 seconds.
Regards