Angle
pBASIC
Posts: 25
i need to get a angle of 40 degrees into a for next loop
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
==============================================
Chris
=============
Age
12
======
grade
7
Webpage
Email=miniwarrior@cox.net
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
==============================================
Chris
=============
Age
12
======
grade
7
Webpage
Email=miniwarrior@cox.net
Comments
You are going to need to give us a little more information in order for us to answer your question.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
==============================================
Chris
=============
Age
12
======
grade
7
Webpage
Email=miniwarrior@cox.net
Typical servos require a signal that ranges from 1mS to 2mS for an "ON" time pulse duration, and a
15 to 25 mS range for an "OFF" time. The Stamp can easily accomplish this with the use of a PULSOUT
command, but the values that you will use, will vary from servo to servo, and depending on what model
Stamp you use.
Now, with that said, not all servos are created equal. The 1 mS to 2mS "ON" time sets the servo position.
With some servos this translates to almost 180 degres, while other servos this can be less than 90 Degrees.
BS1 = 10uS resolution
BS2, BS2e, and BS2pe = 2uS resolution
BS2sx, BS2p, and BS2px = 0.8uS resolution
Assume you have a BS2p with a resolution of 0.8uS. What this means, is that for a 1mS pulse (or 1000uS pulse)
you need to provide a value to the PULSOUT command of 1250 ( 1000 / 0.8 = 1250 ) or for a 2mS pulse (or 2000uS pulse)
you need to provide a value to the PULSOUT command of 2500 ( 2000 / 0.8 = 2500 ).
What does all of this mean?
Well assume also you have a servo that has a complete travel of 180 Degrees. Where 1mS = 0 Degrees and 2mS
= 180 Degrees.
If you want 40 Degrees, then you need to send a 1.2222 mS pulse. ( 1 + 40/180 = 1.2222 )
For the PULSOUT command you need to provide a value of 1527 ( 1222 / 0.8 = 1527.5 )
So FINALLY, if you want to put this in a for next loop, you might have something that looks like this....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
==============================================
Chris
=============
Age
12
======
grade
7
Webpage
Email=miniwarrior@cox.net