Want to turn off my program

For general Flowcode discussion that does not belong in the other sections.
Post Reply
803772
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

Post by 803772 »

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 32 times

RGV250
Posts: 275
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 25 times
Been thanked: 30 times

Re: Want to turn off my program

Post by RGV250 »

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.
exam tester 2.fcfx
(24.88 KiB) Downloaded 32 times
Bob

chipfryer27
Valued Contributor
Posts: 1167
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 287 times
Been thanked: 416 times

Re: Want to turn off my program

Post by chipfryer27 »

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

Post Reply