Servo control with BS2
Jrcone
Posts: 3
I am trying to write a Basic Stamp program to control a servo motor with the Debug screen interface.
I need to be able to enter a decimal number in the Debug screen to tell the servo how many stops to make in it's movement
from fully clockwise to fully counterclockwise with a .25 second pause at each stop. It then needs to return to the starting point
in a continuous movement. I would appreciate any help anyone can give me.
Thanks
I need to be able to enter a decimal number in the Debug screen to tell the servo how many stops to make in it's movement
from fully clockwise to fully counterclockwise with a .25 second pause at each stop. It then needs to return to the starting point
in a continuous movement. I would appreciate any help anyone can give me.
Thanks
Comments
The Basic Stamp Syntax and Reference Manual
What's a Microcontroller?
Robotics with the BoeBot
All can be found by going to the main Parallax page and clicking on the Resources tab, then clicking on the Downloads link.
The first reference can be found under BASIC Stamp Documentation. The other two can be found under Stamps in Class Downloads.
Look at the description of the DEBUGIN and DEBUG statements and read through the discussion in Robotics ... on servo motors and
how to control them with a Stamp. The PULSOUT statement and the PAUSE statement are mostly what's used for that. There's lots
of sample code included in all the references I mentioned.
You also need a piece to divide up the range of pulse widths and moves the servo through a specified piece of its range of motion. You need a piece that pauses for 0.25 seconds, then you need a piece to move the servo back to its starting position.
Start with those pieces. If you have specific questions along the way, ask.
This sounds like a class project. Don't cheat.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
1 segment - 500 to 1000
2 segments - 500 to 750, 750 to 1000
3 segments - 500 to 666, 666 to 832, 832 to 1000
You figure out the general rule.
It may be that your servo has a different mechanical range and a different range for the control pulses (and a different range for the PULSOUT statements). You may need to modify these values somewhat, but this is a good starting point.