BS2sx Program Help
I wrote a program but want to start it with a push button.· I have it wired to input 6 on the stamp and know i·need·an if...then...else statement.··I want to know if anyone knows how to write a program for this.·
Comments
Loop back until the button is pressed, as tested in that IF...THEN statement.
MyButton PIN {whatever pin you have the button on - I'm assuming it will be active High}
DO Until MyButton=1
'Add other stuff that may run waiting for the button - but not too much that it can miss the press
Loop
There are a few ways to complete this task. Put a pull-down resistor on the button and this will ensure you do not get a false trigger. You can split the code up into two pieces, the first one to watch the button and the second to be the program you jump to. Here is a quick example for your review, this should get your started on the right path.
:: Example ::
DO
·· IF IN6 = 1 THEN GOSUB MainProgram
LOOP
MainProgram:
·This is where your program will go
RETURN
I hope this helps
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Joshua Donelson
www.parallax.com