Using Buttons to Initiate Subroutines
I've been at it for several days now and I know Im just missing some small detail, but I want to put an open switch button on the breadboard and use it to initiate a Subroutine.
ex.
DO
IF (IN1= 1) THEN
GOSUB A
ELSE
PAUSE 200
ENDIF
IF (IN2= 1) THEN
GOSUB B
ELSE
PAUSE 200
ENDIF
LOOP
Is there a more standard way for using buttons, or how could I at least make it differentiate between 1 and 0? Its not very neat or practical to use the wiskers, they get in the way, and I dont want to wrap a wire around the chassis, lol.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Keep Moving Forward."
ex.
DO
IF (IN1= 1) THEN
GOSUB A
ELSE
PAUSE 200
ENDIF
IF (IN2= 1) THEN
GOSUB B
ELSE
PAUSE 200
ENDIF
LOOP
Is there a more standard way for using buttons, or how could I at least make it differentiate between 1 and 0? Its not very neat or practical to use the wiskers, they get in the way, and I dont want to wrap a wire around the chassis, lol.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Keep Moving Forward."
Comments
on the switch. If you leave an input pin floating you can get noise on the
pin that will cause·random 0 or 1 states.
See·the attached image
Sam
Post Edited (SamMishal) : 6/4/2009 4:37:03 PM GMT