Shop OBEX P1 Docs P2 Docs Learn Events
guides that doesnt guide at all. — Parallax Forums

guides that doesnt guide at all.

deetwistdeetwist Posts: 3
edited 2014-03-17 18:52 in BASIC Stamp
'
[ Main Routine ]


FOR counter = 1 TO 100 ' Deliver 100 forward pulses
PULSOUT ServoLeft, 850
PULSOUT ServoRight, 735
PAUSE LowTime
LOOP


DEBUG "Done!", CR, ' User instructions
"Press/release reset", CR,
"twice to restart...", CR
END

- I dont know why but I keep getting "undefined symbol" on the LowTime I am just doing what the book has told me to do. can someone help please!. thats for the sumo bot programing.

Comments

  • WBA ConsultingWBA Consulting Posts: 2,934
    edited 2014-03-17 00:59
    deetwist, Welcome to the forums!
    That error is caused when you do not have a CON statement declaring the LOWTIME constant. I assume you are referring to Applied Robotics with the Sumobot as this code is referenced on page 22. Also on that page is the note to add the CON statement:
    √ Add a LowTime constant declaration:
    LowTime CON 20
    

    Do you have that in your code as well?

    Full code from book:
    ' -----[ Program Description ]------------------------------------------------
    ' Applied Robotics with the SumoBot - ForwardLowTimeTest.bs2
    ' SumoBot goes forward indefinitely. Use the Reset button to start and stop
    ' the forward motion.
    '
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    ' -----[ I/O Definitions ]---------------------------------------------------
    ServoLeft PIN 13 ' Left servo connected to P13
    ServoRight PIN 12 ' Right servo connected to P12
    ' -----[ EEPROM Data ]--------------------------------------------------------
    RunStatus DATA 0 ' Start with program not running
    ' -----[ Constants ]----------------------------------------------------------
    LowTime CON 20 ' Try 1 SumoBot with 20 ms pulses
    ' Try the other with 40 ms pulses
    ' -----[ Variables ]----------------------------------------------------------
    temp VAR Byte ' Temporary variable
    counter VAR Byte ' FOR...NEXT loop counter
    ' -----[ Initialization ]-----------------------------------------------------
    DEBUG CLS ' Clear the Debug Terminal
    READ RunStatus, temp ' read current status
    temp = ~temp ' invert status
    WRITE RunStatus, temp ' save for next reset
    IF (temp > 0) THEN ' 0 -> End, 1 -> Main routine
    DEBUG "Press/release Reset..."
    END
    ENDIF
    DEBUG "Main program running...", CR ' Display program status
    ' -----[ Main Routine ]-------------------------------------------------------
    DO ' Forward pulses indefinitely
    PULSOUT ServoLeft, 850
    PULSOUT ServoRight, 650
    PAUSE LowTime
    


    FYI: It is against the forum rules to double post, so I will remove your other thread with the same question.

    And lastly, a tip on posting code on the forums:
    attachment.php?attachmentid=78421&d=1297987572
  • deetwistdeetwist Posts: 3
    edited 2014-03-17 18:52
    Thanks a lot! I am just begining in programmming so Its kinda hard for me to study this area plus I've never had programming background before and english isnt my first dialect so its very hard for me to understand its like Im learning new language!. LOL!... thanks again!
Sign In or Register to comment.