Code for a one Button RUN / STOP for the BS1
Clovey
Posts: 1
in BASIC Stamp
Hello,
I can't seem to figure this one out...
The push button switch is one active low normally open contact which closes when pushed. (P0=0)
My goal is to press the button once to RUN and the same button again to STOP. A flag bit (Bit 0) would change state with Run and STOP. Thanks, Jim
j.aaa8jr@gmail.com
Comments
Hi @Clovey
I don't have the hardware setup to try, but would something like this work for you ?
I used to write a hundred or so BS1 programs every year around Halloween for people using the EFX-TEK Prop-1 controller (has nothing to do with the Propeller 1 which was released after the BS1-powered Prop-1). To do what you want reliably, you'll want a debounce and force the button to be released. You could do it in a subroutine like this:
This ensures a good button press and then allows a clean release. In the main body of your code you could do something like this.
The attached listing compiles, but I did not connect to a BS1.