Shop OBEX P1 Docs P2 Docs Learn Events
Help with BS2 coding — Parallax Forums

Help with BS2 coding

ElectriKCElectriKC Posts: 13
edited 2013-11-09 18:21 in BASIC Stamp
I am doing a project for school and it consists of a ir roaming robot with an arm that is supposed to be raised by a servo. The problem is that I am new to programming and I do not know how to get the servo to move ONLY 90 degrees. It is a 360 degree servo, so I cannot get it to stop rotating when I want the desired angle. I sent the attachment to the code, but I am unsure if it actually uploaded or not. If not, the last portion of my code(the one I am working on for the arm) is destroy_target: ' Fire routine.
FOR pulse_count = 0 TO 0
PULSOUT 12, 750
PULSOUT 13, 750
PULSOUT 14, 500
PAUSE 20
NEXT
GOTO main 12 and 13 are the wheel servos and 14 is for the arm..750 is to make the servo stop(not move in any direction)..Thank You for your help!!
2.bs2 2.1K

Comments

  • FranklinFranklin Posts: 4,747
    edited 2013-11-09 17:02
    You can't set the rotation angle of a CR (360) servo, only hte speed and direction of rotation. You need a standard servo for your arm.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-11-09 18:21
    You could use a pushbutton that would only move the servo when the button is pushed.

    Edit: Actually. I would use two pushbottons. One for CW and one for CCW.
Sign In or Register to comment.