Shop OBEX P1 Docs P2 Docs Learn Events
Test Whiskers routine problem — Parallax Forums

Test Whiskers routine problem

I have a problem with the "Test Whiskers" routine. After typing the program and run the check, I get an error message: Expected a label, variable, or instruction. It highlights the " P7 =' BIN1 IN7 line. I have tried to input it from scratch several times, with no luck.

Comments

  • Welcome to the forum!

    This runs fine. Make sure you have the two directives on top, ($STAMP BS2 and $PBASIC 2.5)

    In your post you have " P7 =' BIN1 IN7. That should be a double quote after the egual sign.
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    ' TestWhiskers.BS2
    ' Display what the I/O pins connected TO the whiskers sense.
    
    counter VAR Byte
    FOR counter =1 TO 100 ' Signal program start/reset.
    PULSOUT 2, 750
    PAUSE 20
    NEXT
    DEBUG "WHISKER STATES", CR,
    "Left Right", CR,
    "------ ------"
    DO
    DEBUG CRSRXY, 0, 3,
    "P5 = ", BIN1 IN5, "P7 = ", BIN1 IN7
    PAUSE 50
    LOOP
    
  • Thanks for the help! The routine you posted works well. One question: the routine you posted has additional lines at the beginning that is not in the book example. Did you add this? Again, thanks!
  • Pasiego wrote: »
    Thanks for the help! The routine you posted works well. One question: the routine you posted has additional lines at the beginning that is not in the book example. Did you add this? Again, thanks!

    The first four lines are are comments, preceded with an asterisk ( ' ). The first two are necessary for the program to know what Basic Stamp your programming. The other two are just comments that can be omitted, they are for the user's information. The actual program starts with: "counter VAR Byte"
  • PublisonPublison Posts: 12,366
    edited 2017-05-26 14:25
    Pasiego wrote: »
    Thanks for the help! The routine you posted works well. One question: the routine you posted has additional lines at the beginning that is not in the book example. Did you add this? Again, thanks!

    Good you got it working! We are here to help.

    I did not know which book you were working out of, so I just googled "TestWhiskers.BS2", and that is what I came up with.

    In the future it would be good to post your code, so we can take a look at it.



Sign In or Register to comment.