Shop OBEX P1 Docs P2 Docs Learn Events
Robot keeps going in circle — Parallax Forums

Robot keeps going in circle

robotlover4everrobotlover4ever Posts: 2
edited 2013-11-14 13:17 in General Discussion
I created a code for a robot to go through this maze thing that I had built for it. The problem? It keeps going in circles. It can't be a problem with the code because the code has worked on my friends robot, but it won't work on mine. At first, I thought it was a battery problem.. but new batteries hasnt solved anything.

Whats the problem?

Here is the code for my robot.
[FONT=arial]' {$STAMP BS2}[/FONT]
[FONT=arial]DEBUG "Program Running!"[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]counter        VAR     Word[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FREQOUT 4, 2000, 3000                       ' Signal program start/reset.[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 220                      ' Number of pulses - run time.[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650                            ' Left servo full speed ccw.[/FONT]
[FONT=arial]  PULSOUT 12, 825                            ' Right servo full speed cw.[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 40                      ' Number of pulses - run time.[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650                            ' Left servo full speed ccw.[/FONT]
[FONT=arial]  PULSOUT 12, 750                            ' Right servo full speed cw.[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 45[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650[/FONT]
[FONT=arial]  PULSOUT 12, 845[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 40[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650[/FONT]
[FONT=arial]  PULSOUT 12, 750[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 120                      ' Number of pulses - run time.[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650                            ' Left servo full speed ccw.[/FONT]
[FONT=arial]  PULSOUT 12, 825                            ' Right servo full speed cw.[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 40[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 750[/FONT]
[FONT=arial]  PULSOUT 12, 850[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 95[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650[/FONT]
[FONT=arial]  PULSOUT 12, 825[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 40[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 750[/FONT]
[FONT=arial]  PULSOUT 12, 850[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 67[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650[/FONT]
[FONT=arial]  PULSOUT 12, 825[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 37[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 750[/FONT]
[FONT=arial]  PULSOUT 12, 850[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 25[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650[/FONT]
[FONT=arial]  PULSOUT 12, 825[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 40[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650[/FONT]
[FONT=arial]  PULSOUT 12, 750[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 35[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650[/FONT]
[FONT=arial]  PULSOUT 12, 825[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 40[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650[/FONT]
[FONT=arial]  PULSOUT 12, 750[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 210[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650[/FONT]
[FONT=arial]  PULSOUT 12, 825[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]

[FONT=arial]END[/FONT]
Sign In or Register to comment.