Shop OBEX P1 Docs P2 Docs Learn Events
Erratic CPU.delay response — Parallax Forums

Erratic CPU.delay response

redstone117redstone117 Posts: 2
edited 2007-11-05 02:27 in General Discussion
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 nono.gif. I saw on a forum post from 2004 that·CPU.delay·causes erratic responses on Javelin boards. Has this issue not been fixed?

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-11-04 21:16
    Which forum post do you refer to?

    regards peter
  • redstone117redstone117 Posts: 2
    edited 2007-11-05 00:40
    http://forums.parallax.com/forums/default.aspx?f=8&m=1873&g=2574#m2574
    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...
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-11-05 02:27
    Looks like this a power issue.
    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
Sign In or Register to comment.