BSP2x (noise) re-setting randomly
in BASIC Stamp
Hello,
I set up a very basic instruction of moving a parallax servo to about 90 deg and back to 0 deg after 5 seconds.
The processor and servo moved as expected, but a few seconds later and sometimes after a minute or two (randomly) it re-run the program by itself and the servo will move following the program.
Do you know why this can happen randomly?
Thanks
Comments
What is your power supply? Is it enough for the servo and the BS2sx and anything else you're powering?
Are you keeping the servo refreshed?
And... it's always useful to provide the code that is giving you problems.
Hello Jon,
Thank you for your reply, I checked all connections and made sure that the batteries are ok. I'm using a separate battery as I'm using the board (super carrier)
I then changed to the board of education Rev C with a fresh BS2px and a different servo but the same thing happened. I thought because this board has the actual servo sockets will help, but it didn't
The code is:
($Stamp BS2px)
($PBasic 2.5)
Counter VAR Word
For Counter =1 to 800
Pulsout 15, 1000
Pause 20
Next
For Counter =1 to 200
Pulsout 15, 2125
Pause 20
Next
END
This move the servo nicely 90 degrees, hold it for about 15-16 seconds and return it to the same position.
The problem it starts repeating the program like 3 or 4 times randomly. The majority of the time it re start the code like every 30-38 seconds after it concluded.
After those repetitions it eventually stops and never moves again. I removed the "END" at the end of the code to see it it was going to help but it did the same.
Thanks

Change END to STOP and that should fix the problem (see the help file to learn why).
Note, though, if you put any load on your servo you will see drift unless you update it. The team at Legoland once used BASIC Stamps in some of their displays and I showed them this subroutine to create a delay while keeping the servo steady. They used it on a Lego X-Wing display.