How to get a robot to drive striaght and turn 90 degrees(Very, very new to this please help) — Parallax Forums

# How to get a robot to drive striaght and turn 90 degrees(Very, very new to this please help)

Posts: 1
edited 2019-10-11 07:26 in Robotics
Hi,

I am using Basic stamp for a simple project to learn coding and robotics. I have a robot that will need to:
-drive straight for 2 feet
-turn 90 degrees counterclockwise
-drive 1/2 foot
-turn 90 counterclockwise
-drive for 2 feet
-turn 90 degrees clockwise

I was thinking of repeating this and putting it in a loop.. can anyone help me with an example of how to turn 90 degrees or how to loop this in basic ?
I have minimal experiance using MATLAB and python.

This is what I have experimented with so far...
```' {\$STAMP BS2}
' {\$PBASIC 2.5}
counter VAR Word
DEBUG "Counterclockwise 10 o'clock", CR
FOR counter = 1 TO 50
PULSOUT 13, 700
PAUSE 20
PULSOUT 12, 800
PAUSE 20
NEXT
DEBUG "Clockwise 2 o'clock", CR
FOR counter = 1 TO 50
PULSOUT 12, 700
PAUSE         20
NEXT
FOR counter = 800 TO 700 STEP 8
PULSOUT 13, counter
PAUSE 20
PULSOUT 12, counter
PAUSE 20
NEXT
DEBUG "Center 12 o'clock", CR
FOR counter = 1 TO 80
PULSOUT 13, 760
PAUSE 20
PULSOUT 12, 760
PAUSE 20
NEXT
DEBUG "Counterclockwise 10 o'clock", CR
FOR counter = 1 TO 50
PULSOUT 13, 800
PAUSE 20
PULSOUT 12, 700
PAUSE 20
NEXT
DEBUG "All done."
END
```