Shop OBEX P1 Docs P2 Docs Learn Events
Having a servo problem... — Parallax Forums

Having a servo problem...

YojimboYojimbo Posts: 40
edited 2006-01-04 06:43 in General Discussion
I can't seem to get my robot to navigate properly using a library file I made. I think everything is correct, but it only seems to execute the first two manuvers in the Pingtest2.java program. It go turn both right, left, and go forward, but it keeps hanging or something after the first two. Any ideas would be appreciated. Thank you, and Happy New Year!


-Sean

PS

Ping.java and Navi.java are the two library files.

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-01-01 02:41
    In your library classes you call start() even when the PWM is already started.
    That is an error.

    Use method
    ··PWM(int pin, int highTime, int lowTime)

    to start it running when you create/define your PWM.
    Then you can remove the start() calls after update() calls.



    regards peter
  • YojimboYojimbo Posts: 40
    edited 2006-01-04 00:03
    Well, I seem to have a memory leak somewhere and I just can't find it. I have gotten the robot to be much more responsive, almost ideally, except I run out of memory after 15 seconds or so. I fixed a bunch of stuff in my library files, and tryied to epand my code just a little bit so I wasn't constantly using PWM.update when I didn't need to, as I though initially that was the memory leak. Any insight would be much appreciated. Drive.java is the main program while Ping.java and Navi.java are library files. Thanks!!
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-01-04 06:14
    In Drive,
    constructs like
    ······· System.out.println(n + " Right Turn.");
    will create temporary strings that are only used once.
    Use
    · System.out.print(n);
    · System.out.println(" Right Turn.");

    regards peter
    ·
  • YojimboYojimbo Posts: 40
    edited 2006-01-04 06:43
    Perfect. Thank you, it would have taken me forever to find it.
Sign In or Register to comment.