help with code for bush button
studiomagic
Posts: 10
I want to be able to push a NO button on P3·to move a servo. ·Here is what I have so far. It want let me move the servo more than once. I want to move each time the button is pushed. What am I missing?
DO
IF IN3 = 1 THEN
GOTO Blink:
ENDIF
LOOP
Blink:
DEBUG "Counterclockwise 10 o'clock", CR
FOR Counter = 1 TO 35
PULSOUT 13 1000
PAUSE 7
NEXT
DEBUG "Clockwise·3 o'clock", CR
FOR Counter = 1 TO 35
PULSOUT 13 1000
PAUSE 7
NEXT
DEBUG "Counterclockwise 10 o'clock", CR
FOR Counter = 1 TO 35
PULSOUT 13 1000
PAUSE 7
NEXT
·
DO
IF IN3 = 1 THEN
GOTO Blink:
ENDIF
LOOP
Blink:
DEBUG "Counterclockwise 10 o'clock", CR
FOR Counter = 1 TO 35
PULSOUT 13 1000
PAUSE 7
NEXT
DEBUG "Clockwise·3 o'clock", CR
FOR Counter = 1 TO 35
PULSOUT 13 1000
PAUSE 7
NEXT
DEBUG "Counterclockwise 10 o'clock", CR
FOR Counter = 1 TO 35
PULSOUT 13 1000
PAUSE 7
NEXT
·
Comments
2) Blink will get called as long as the button is held down. If that's what you want, leave it as described.
3) If you want only one set of movements, you have to wait after the DO for the button to be released like:
Here's what I'm trying to do. I have two servo's, one is connected to P13 and the other is connected to P14.They will be moving eyes in a puppet. P2 is a push button for the left eye and P3 is a push button for the right eye. I don't want to have to hold down the button. I have programmed servo's to run a set per program so that both eyes blink together, but I want to interrupt the program and be able to blink each eyes individually. As it stands I can blink each eye only one time then the program starts back over and I have to wait until it get to "DO". I'm lost!!!!!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen