Bicolor LED and Servo
chasing
Posts: 14
Is it possible to use a bicolor LED to show the direction a servo is moving on a BOE with a BS2? I've used regular red LEDs to show if a servo was moving in my BOE-Bot projects, but that didn't differentiate between clockwise and counter clockwise movement; only off and on. Would I have to write two separate subroutines (one for clockwise and one for counterclockwise) or can I just use 'IF THEN" statements? Any suggestions would be appreciated.
Comments
so something like this to wag from side to side ? connect the LED to 12 and 13
Do
pulsout 14, 350 ' moves your servo to the right
pause 20
high 13 ' shows on bicolour
low 12
pause 500
pulsout 14, 1150 ' moves your servo to the left
pause 20
low 13 ' shows the other bicolour ' reverses circuit
high12
pause 500
loop
(connect the LED to 12 and 13)
direction 1: FOR B0=1 TO 100' one direction, varies by servo
pulsout 14, 500' min value
high 12
pause 20
low 12
next
direction2: FOR B0=1 TO 100' other direction
pulsout 14, 1000' max value
high 13
pause 20
low 13
next
goto direction1' repeat
direction 1: FOR W0=500 TO 1000 step 50' one direction, varies by servo
pulsout 14, W0' min value
high 12
pause 20
low 12
next
direction2: FOR W0=1000 TO 500 step 50' other direction
pulsout 14, W0' max value
high 13
pause 20
low 13
next
goto direction1' repeat