Shop OBEX P1 Docs P2 Docs Learn Events
How to use/code for a potentiometer — Parallax Forums

How to use/code for a potentiometer

apmorgan93apmorgan93 Posts: 1
edited 2013-10-17 09:42 in Learn with BlocklyProp
In my class we are learning how to program using the basic stamp. Last week we made a loop to control 2 servos to drive the chip around in a rectangle. Well I loaned one out and took it home to experiment with. I'd like to make something where I use a potentiometer to control the angle of the servo. I've spent a few hours googling and scouring the internet for how to go about doing this or how to even code for a potentiometer and I've found absolutely nothing useful pertaining to the basic stamp. Can someone please help me or give me links to where I can learn how to do this?

Comments

  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-10-16 21:16
    First, Welcome to the Forums. This link will take you to the Basic Stamp page: Click on the Downloads tab at the bottom. The "What's A Microcontroller" is the best place to start. There are several other great downloads there. Once you have read through that and have built you circuit and tested your code, if you run in to problems come back to the forum and you will get plenty of help. Enjoy.

    Another good source: Robotics With the Boe Bot

    EDIT: I would also like to point out that the Basic Stamp forum is the best place to post questions about Stamps. It is also a great resource for finding info on problems, projects, etc. that others have had.
  • Steph LindsaySteph Lindsay Posts: 767
    edited 2013-10-17 09:42
    The "What's a Microcontroller?" text, a free download, has an activity called Controlling a Servo with a Potentiometer (page 156 in v3.0). This activity uses a standard servo though—the pulses tell it what angular position to go to and then hold, resisting force trying to twist it away from that position.

    If you are working with a Boe-Bot robot, you have continuous rotation servos. The code from What's a Microcontroller (ControlServoWithPot.bs2) would not give the same results as it would with a standard servo.

    For continuous rotation servos, the pulses tell it to rotate at a certain speed and direction. The only way to get it to hold a certain position is to know how long it would take to rotate to that angle, and then stop sending pulses. It would not be able to resist a force trying to twist it away from that position.
Sign In or Register to comment.