A bit of a problem with servo controls...and for-nexts
I've just got into playing around with my Homework Board, nifty little platform that it is, so I decided to try a for-next loop to see what it could do with servomotors.
As you can see from the code I have posted, the syntax is tokenizable, however, the servo-motor seems to return to a certain position after every pulsout step.· The behaviour intended was for the servo to go to the most counterclockwise position, and then progress in steps to the most clockwise position.· Either I'm missing something about the nature of the servomotor itself, or I'm coding up the wrong tree here
Any suggestions/comments would be appreciated
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
A jug of wine
A loaf of bread
And thou
As you can see from the code I have posted, the syntax is tokenizable, however, the servo-motor seems to return to a certain position after every pulsout step.· The behaviour intended was for the servo to go to the most counterclockwise position, and then progress in steps to the most clockwise position.· Either I'm missing something about the nature of the servomotor itself, or I'm coding up the wrong tree here
value var byte PULSOUT 4, 500 PAUSE 1000 'Do stuff according to the same steps FOR value = 0 TO 40 STEP 2 PULSOUT 4, (500+((value/2)*25)) PAUSE 2000 DEBUG CR, "Interval: " DEBUG DEC value DEBUG CR, "Pulsout: " DEBUG DEC (500+((value/2)*25)) NEXT end
Any suggestions/comments would be appreciated
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
A jug of wine
A loaf of bread
And thou
Comments
X var BYTE
Value var WORD
FOR Value = 500 to 1000 Step 50 ' Define range and steps
DEBUG "Pulseout: ", DEC Value, CR
FOR X = 1 to 20 ' send a pulse triain of 20 to hold for about 1/2 second (20 x (20mSec + pulse time ect))
Pulsout 4, Value
PAUSE 20
NEXT
NEXT ' go to next step
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hebel
Electronic Systems Technologies
Southern Illinois University Carbondale
Personal Links - ·Lot of BASIC Stamp info
and
SelmaWare Solutions
StampPlot Pro Version 3 Release 4
Graphical Data Acquisition for your Micro and Imagination!
Now allows additional controls to be added, or developed.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
A jug of wine
A loaf of bread
And thou
I somehow get the impression that using such small pulsout increments so rapidly·is not good for the mechanics of the servomotor.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
A jug of wine
A loaf of bread
And thou
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hebel
Electronic Systems Technologies
Southern Illinois University Carbondale
Personal Links - ·Lot of BASIC Stamp info
and
SelmaWare Solutions
StampPlot Pro Version 3 Release 4
Graphical Data Acquisition for your Micro and Imagination!
Now allows additional controls to be added, or developed.
·
Check out page 103 of "What is a Microcontroller" (http://www.parallax.com/dl/docs/books/edu/wamv2_2.pdf)
Ryan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ryan Clarke
Parallax Tech Support
rclarke@parallax.com