Problem with controlling a simple servo
Scott B
Posts: 5
I have a problem when I try to control a simple servo with the following code it appear the loop is not working correctly. All that happens is the servo moves to the 850 position and the debug screen shows "Program Running" over and over and over as if the loop never ends and it never does go to the second clockwise loop. I have a BS2 homework board and I am new to this, does anyone know what is wrong? Is there a setting or something that I should have changed? Thanks!
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
counter VAR Word
FOR counter = 1 TO 120 ' Loop for three seconds
PULSOUT 14, 850 ' P14 servo counterclockwise
PAUSE 20
NEXT
FOR counter = 1 TO 124 ' Loop for three seconds
PULSOUT 14, 650 ' P14 servo clockwise
PAUSE 20
NEXT
END
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
counter VAR Word
FOR counter = 1 TO 120 ' Loop for three seconds
PULSOUT 14, 850 ' P14 servo counterclockwise
PAUSE 20
NEXT
FOR counter = 1 TO 124 ' Loop for three seconds
PULSOUT 14, 650 ' P14 servo clockwise
PAUSE 20
NEXT
END
Comments