help with servo
Hi I recently made a sun tracker with solar panels and all that good stuff but when nearly completed I couldn't figure out how to make the servo go in reverse if it's just code fine, if it's just that I need to tweak the servo fine. Thank you for your help. by the way I'm using the basic stamp 2 with the board of education.
Comments
' {$STAMP BS2}
' {$PBASIC 2.5}
timeTop VAR Word
timeBottom VAR Word
timeMiddle VAR Word
DO
HIGH 6
HIGH 1
HIGH 10
PAUSE 2
RCTIME 1,1,timeBottom
RCTIME 6,1,timeMiddle
RCTIME 10,1,timeTop
DEBUG HOME, "timeTop = ", DEC5 timeTop, "timeBottom = ", DEC5 timeBottom, "timeMiddle = ", DEC5 timeMiddle
PAUSE 100
IF (timeTop+30<timeMiddle) THEN
PULSOUT 12, 625
ELSEIF (timebottom+30<timeMiddle) THEN
PULSOUT 12, 625 'this is were i'm having trouble with getting the servo to go the opposite way
ENDIF
LOOP
BTW "I just need to know" is not a good way to get an answer. "I'd like to know" would be more appropriate.
http://www.parallax.com/Portals/0/Downloads/docs/prod/edu/28123-WAM-v3.0.pdf
... Specifically Chapter 4 Activity #2 "ACTIVITY #2: SERVO CONTROL TEST PROGRAM"
As Beau suggested - Specifically check out:
Figure 4-18: Servo Horn Positions, PULSOUT Commands, and ms Pulse Duration
on page 109.
That should get you started, plus by entering different values for the duration of the pulses, you'll get a feel for how a servo works.
In other words, make mistakes and see what happens :-)
That's the way I learn best - and remember that "letting the smoke out" isn't always bad - I've learned a lot by doing exactly that
Oh, and BTW, welcome to the Forums!
-Matt
That is absolutely true, piezyxw!
However, a "head full of answers" isn't nearly as good as a "thinking head". :-) You asked a question, got some advice on where to find the info you needed, did the research yourself - and came up with the answer you were looking for.
Well done! Build upon this and the sky's the limit ;-)
-Matt
Could you post a pic of what you've done? It sounds pretty cool :-)
-Matt