Shop OBEX P1 Docs P2 Docs Learn Events
Programming Help, Please — Parallax Forums

Programming Help, Please

jason_wujason_wu Posts: 4
edited 2004-09-16 08:07 in BASIC Stamp
anyone can answer my question coz i need it very much....thanks you!!!!!!!!

Post Edited By Moderator (Jon Williams) : 9/16/2004 2:54:32 PM GMT

Comments

  • DaveGDaveG Posts: 84
    edited 2004-09-15 16:35
    Jason,

    Your code looks okay, except for one missing command.
    You need to add a PAUSE 20 in the following places.

    left_turn:
    for pulse_count = 1 to 35
    pulsout 12, 500
    pulsout 13, 500
    PAUSE 20 'add this line
    next
    goto main

    right_turn:
    for pulse_count = 1 to 35
    pulsout 12, 1000
    pulsout 13, 1000
    PAUSE 20 'add this line
    next
    goto main

    u_turn:
    for pulse_count = 1 to 75
    pulsout 12, 1000
    pulsout 13, 1000
    PAUSE 20 'add this line
    next
    goto main

    The servos used in your robot need to have their commands sent at certain rate, 50 Hz.
    The PAUSE 20 command inserts a delay of 20ms between each set of pulsout commands, which
    essentially slows down the turning loops(left_turn, right_turn, etc) to a 50Hz rate.

    I would also suggest that you test each little group of code, before you try to get the whole
    robot to work.

    Dave G.
  • jason_wujason_wu Posts: 4
    edited 2004-09-16 08:07
    thanks for your suggestion,Dave G..i hope i can learn more about robot from you.Lastly,thank you very much!!!!!

    and nice to meet you too....
Sign In or Register to comment.