Shop OBEX P1 Docs P2 Docs Learn Events
My program seems to "glitch" then runs in a loop — Parallax Forums

My program seems to "glitch" then runs in a loop

smith772smith772 Posts: 3
edited 2013-02-10 15:37 in BASIC Stamp
Hi, I am working on a project and I am getting some inconsistent behavior from my boe bot. Sometimes when I run a program, it runs just fine, other times, when running the same program, it "glitches" which means it jerks and doesn't complete the movement, then starts running in a loop, when there is no loop. I have tried many things, like disconnecting the battery for a time, reloading the program, re-writing the program, and sometime it helps, works for a few times, then starts acting up again.

Here is an example. It starts to run, goes in a circle, then makes a jerky move and starts running in a loop, when there is no loop

Please help!

' {$STAMP BS2}
' {$PBASIC 2.5}
counter VAR Word


FOR counter = 1 TO 35
PULSOUT 13, 850
PULSOUT 12, 750
PAUSE 20
NEXT


FOR counter = 1 TO 60
PULSOUT 13, 800
PULSOUT 12, 750
PAUSE 20
NEXT


FOR counter = 1 TO 28
PULSOUT 13, 830
PULSOUT 12, 700
PAUSE 20
NEXT


FOR counter = 1 TO 28
PULSOUT 13, 700
PULSOUT 12, 830
PAUSE 20
NEXT


END

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-02-10 15:37
    Typically this sort of problem is due to a weak battery. The drain of the servo motors causes the voltage to drop and below about 4.3V, the Stamp will reset. Often a brief pause in motor use is enough to allow the battery voltage to rise to where the Stamp will operate, but any significant motor use and the voltage will drop again
Sign In or Register to comment.