uhh yeah, how do i make a servo go backwards?
zemkacz
Posts: 19
this is what i have so far
now im usisng a light resitor for sensing light and using a servo to make it go back and forward, i got it going back when bright enought but it cant go forward, i have no idea on what i should use to make the servo reverse itself when it gets to dark.
' {$STAMP BS2} ' {$PBASIC 2.5} time VAR Word counter VAR Word DO GOSUB servo GOSUB sensor_light LOOP servo: IF time > 1000 THEN FOR counter = 1 TO 200 PULSOUT 15, 5 NEXT IF time < 1000 THEN FOR counter = 1 TO 200 PULSOUT 15, 5 NEXT ENDIF ENDIF RETURN sensor_light: HIGH 2 PAUSE 100 RCTIME 2, 1, time DEBUG HOME, "time = ", DEC5 time LOW 2 RETURN
now im usisng a light resitor for sensing light and using a servo to make it go back and forward, i got it going back when bright enought but it cant go forward, i have no idea on what i should use to make the servo reverse itself when it gets to dark.
Comments
Oh, and it would help to have a "MoveServo" subroutine:
MoveServo:
· PULSOUT 15, ServoVal
· PAUSE 20
· RETURN
Then, set ServoVal to 750 (2 uSec per 'tick', 750 'ticks' * 2 uSec is 1.5 mSec, the centered 'pulse' value) for centered, 500 for full left, 1000 for full right -- or set ServoVal as appropriate, given your light-meter reading.
·