Newbie in need of help
Catch22
Posts: 1
Hey. For my school project I have two buttons hooked up as in the servo control example in page 129 of What's a Microcontroller (active-high). Im tryin to set it up so the first button initiates the program.. and the other may pause it either between subs or immediately, if possible. I do not know how to make the BASIC2 board "wait" and respond to the second button. The only thing that is mentioned in the documents that I recieved with my Board of Education vC is on page 301- POLLIN but it says it's only for BS2p and BS2pe.
What are my options?
Here is my main function:
Main:
· BUTTON 3,1,255,0,btnWrk,0,Main· 'restarts the program unless button3 is pressed
··· DEBUG HOME, "Running Cycle", CR
··· BUTTON 4, 1, 255, 0,btnWrk,1, Freeze
··· GOSUB Scoop
···· BUTTON 4, 1, 255, 0,btnWrk,1, Freeze
··· GOSUB FeedServe
··· BUTTON 4, 1, 255, 0,btnWrk,1, Freeze
··· PAUSE 1000
··· GOSUB FeedRetract
····· IF(IN3 = 0 AND IN4 = 1) THEN
····· GOSUB Freeze
····· ENDIF
·DEBUG "done"
END
The only real way of making this stop is to hold the pin-4 button.. but I want something a little more elegent..
htank you very much!
tom
What are my options?
Here is my main function:
Main:
· BUTTON 3,1,255,0,btnWrk,0,Main· 'restarts the program unless button3 is pressed
··· DEBUG HOME, "Running Cycle", CR
··· BUTTON 4, 1, 255, 0,btnWrk,1, Freeze
··· GOSUB Scoop
···· BUTTON 4, 1, 255, 0,btnWrk,1, Freeze
··· GOSUB FeedServe
··· BUTTON 4, 1, 255, 0,btnWrk,1, Freeze
··· PAUSE 1000
··· GOSUB FeedRetract
····· IF(IN3 = 0 AND IN4 = 1) THEN
····· GOSUB Freeze
····· ENDIF
·DEBUG "done"
END
The only real way of making this stop is to hold the pin-4 button.. but I want something a little more elegent..
htank you very much!
tom
Comments
Each button in any loop must have it own seperate btnWrk variable.
Not sure if that is what's causing your problem though...
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video Display Module" Available Now.
www.sxvm.com
"I thought I was wrong once...But I was mistaken [noparse];)[/noparse]"
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA