Erratic CPU.delay response
Using: Javelin Stamp IDE 2.0.3, import stamp.core.*;, serial cable, 9Vdc wall plug
CPU.delay is causing the previous command to loop erratically. I made a call to forward(), which simply pulses the servos forward, followed by CPU.delay(20000). Unfortunately, the motors drive forward for 2 seconds, pause, and then·continue to loop·moving forward·and·pausing in·2 second bursts indefinitely. When CPU.delay(20000) was changed to CPU.delay(30000), it did not loop the first time through. Success, right? Not really... I tried it again with the code:
<code>
····· forward();
····· CPU.delay(30000);
····· reverseRight();
····· CPU.delay(25000);
</code>
and the robot·then continuously looped·moving forward for·3 sec,·reverseRight for·2.5 sec, and pausing
. I saw on a forum post from 2004 that·CPU.delay·causes erratic responses on Javelin boards. Has this issue not been fixed?
CPU.delay is causing the previous command to loop erratically. I made a call to forward(), which simply pulses the servos forward, followed by CPU.delay(20000). Unfortunately, the motors drive forward for 2 seconds, pause, and then·continue to loop·moving forward·and·pausing in·2 second bursts indefinitely. When CPU.delay(20000) was changed to CPU.delay(30000), it did not loop the first time through. Success, right? Not really... I tried it again with the code:
<code>
····· forward();
····· CPU.delay(30000);
····· reverseRight();
····· CPU.delay(25000);
</code>
and the robot·then continuously looped·moving forward for·3 sec,·reverseRight for·2.5 sec, and pausing
![nono.gif](http://forums.parallax.com/images/smilies/nono.gif)
Comments
regards peter
See Dimitri's post at the bottom.
Now that we are using battery power and not wall power, the program no longer loops and functions normally... we'll see how long this lasts...
What are the characteristics of your wall power supply: voltage, current rating, ripple ?
Are you powering the servos from the same power supply? How much current draws
the servo?
I think the javelin may be reset. Easy way to check: print a simple startup text
at the start of main() outside the main while loop (if any).
regards peter
Post Edited (Peter Verkaik) : 11/5/2007 2:32:03 AM GMT