Shop OBEX P1 Docs P2 Docs Learn Events
Programming trouble — Parallax Forums

Programming trouble

Farmall JDFarmall JD Posts: 5
edited 2009-01-03 21:55 in BASIC Stamp
Hi everyone. I am a green horn to all this so be gentle. I am working on the BOE kit and activity #5 the reaction timer. I wrote the program just like it is in the book but I am coming up with error 141. Here is what it all looks like. The error is happening at the 1st "DO" and then if I delete it hits the next one. Anyone have an idea for me?? confused.gif Thank you for all your help.

' {$STAMP BS2}
' {$PBASIC 2.5}

' Test reaction time with a push button and bi-coloured led

timeCounter VAR Word ' Declare variable to store time

DEBUG "Press and hold the pushbutton." , CR,
"to make the light turn RED." , CR,
"When the light turns Green, let", CR,
" go as fast as you can.", CR, CR,


DO 'Begin the main loop
DO ' Nested loop repeats until
' the BUTTON is pressed
LOOP UNTIL IN3 = 1

LOW 14 ' Bi-colour LED Red
HIGH 15

PAUSE 1000 ' 1 sec delay

HIGH 14 'LED turns Green
LOW 15

timeCounter = 0 ' Set timeCounter to zero

DO ' Nested loop, count time

PAUSE 1
timeCounter = timeCounter + 1

LOOP UNTIL IN3 = 0 ' Until pushbutton is released

LOW 14 ' LED off

DEBUG "Your time was", DEC timeCounter, ' Display time
"ms.", CR, CR,
"To play again, hold the", CR 'play again instructions
"button down again." CR,CR

LOOP ' back to "Begin main loop"

Comments

  • MikerocontrollerMikerocontroller Posts: 310
    edited 2009-01-03 00:52
    · Remove the last comma in the first·DEBUG statement. Also place a comma·after CR in the third line of your last DEBUG statement·and also after "button down again."·
  • Farmall JDFarmall JD Posts: 5
    edited 2009-01-03 01:00
    Mike Thank you so much.. Its funny how something small like that can shut you down. smilewinkgrin.gif
  • MikerocontrollerMikerocontroller Posts: 310
    edited 2009-01-03 01:06
    · I would be lost without error messages.· Making syntax mistakes is something I do all the time.·
  • Farmall JDFarmall JD Posts: 5
    edited 2009-01-03 01:08
    Where could I find out the definitions of the errors, or at least more info on them when they happen.
  • MikerocontrollerMikerocontroller Posts: 310
    edited 2009-01-03 01:24
    That might be a good question for Mike Green. I can't find any collective listing of error message explanations in the Basic Stamp Syntax and Reference Manual.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2009-01-03 02:11
    Hi, you can download the PBasic_Tokenizer.zip at the bottom of the page at this link http://www.parallax.com/tabid/441/Default.aspx

    The zip file contains a PDF file called Usng The PBasic Tokenizer Library, starting at page 20 is a list of error messages.

    Jeff T.
  • Farmall JDFarmall JD Posts: 5
    edited 2009-01-03 21:55
    Thank you Unsoundcode I'll check it out..
Sign In or Register to comment.