Shop OBEX P1 Docs P2 Docs Learn Events
LightMeter.bs2 program troubles. HELP!!!!!!!!!! — Parallax Forums

LightMeter.bs2 program troubles. HELP!!!!!!!!!!

trekspert42trekspert42 Posts: 4
edited 2012-03-31 22:43 in BASIC Stamp
hey everyone, new here and i've got a problem with the LightMeter.bs2 program using the 7-seg LED display. for some odd reason, when i click run, a pop-up come up saying "expected a label", and it has the second index highlighted when it is trying to update the disply in the program . i made sure it wasn't my computer or the board, and i have everything typed in correctly. what is up?!?!?!?!?!

Comments

  • FranklinFranklin Posts: 4,747
    edited 2012-03-31 20:47
    If you include your code (between [code] tags) perhaps we could help.
  • trekspert42trekspert42 Posts: 4
    edited 2012-03-31 21:25
    opps. here is the program im having issues with.


    ' {$STAMP BS2}' {$PBASIC 2.5}' What's a Microcontroller - LightMeter.bs2' Indicate light level using 7-segment display.DEBUG "Program Running!"index VAR Nibtime VAR WordOUTH = %00000000DIRH = %11111111DO GOSUB Get_Rc_Time GOSUB Delay GOSUB Update_DisplayLOOPGet_Rc_time: HIGH 2 PAUSE 3 RCTIME 2, 1, timeRETURNDelay: PAUSE timeRETURNUpdate_Display: IF index = 6 THEN index = 0 LOOKUP index, [ %01000000, %10000000, %00000100, %00000010, %00000001, %00100000 ], OUTH index = index + 1RETURNWhere its highlighted in red is where im having issues. im using the BS homework board. When i hit run, a message pops up and says "expected a label". it also highlighted the word indexwhich i italicized above. What is happening???
  • trekspert42trekspert42 Posts: 4
    edited 2012-03-31 21:34
    leeme try that again


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

    DEBUG "Program Running!"

    index VAR Nib
    time VAR Word

    OUTH = %00000000
    DIRH = %11111111

    DO

    GOSUB Get_Rc_Time
    GOSUB Delay
    GOSUB Update_Display

    LOOP

    Get_Rc_time:

    HIGH 2
    PAUSE 3
    RCTIME 2, 1, time

    RETURN

    Delay:

    PAUSE time

    RETURN

    Update_Display:

    IF index = 6 THEN index = 0

    LOOKUP index, [ %01000000,
    %10000000,
    %00000100,
    %00000010,
    %00000001,
    %00100000 ], OUTH
    index = index + 1

    RETURN
  • trekspert42trekspert42 Posts: 4
    edited 2012-03-31 21:36
    were it says, IF index = 6 THEN index = 0, a message pops up saying it expected a label and it highlighted the second index. I dont know what it is telling me. HELP!!!!!!!!!!!!!!!
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-31 22:43
    You will have that problem only if you leave out the line ' {$PBASIC 2.5}. But you have that line, and your program compiles fine on my computer. Also:

    attachment.php?attachmentid=78421&d=1297987572

    -Phil
Sign In or Register to comment.