' ========================================================================= ' ' File...... ButtonLEDTest.bs2 ' Purpose... Test Buttons and LEDs on GPS Datalogger Board ' Author.... Chris Savage -- Parallax, Inc. ' E-mail.... csavage@parallax.com ' Started... 10-14-2008 ' Updated... 11-30-2008 ' ' {$STAMP BS2} ' {$PBASIC 2.5} ' ' ========================================================================= ' -----[ Program Description ]--------------------------------------------- ' Thi program tests the Bi-Color LED on the GPS Datalogger Board by ' blinking it Red 5 times, then Green 5 times and finally alternating 5 ' times. ' ' The program will then wait for you to press the buttons and tell you ' which one you're pressing. ' -----[ I/O Definitions ]------------------------------------------------- LEDK PIN 0 ' Bi-Color LED Cathode LEDA PIN 1 ' Bi-Color LED Anode BTN2 PIN 12 ' Button 2 BTN1 PIN 15 ' Button 1 ' -----[ Constants ]------------------------------------------------------- Yes CON 1 ' Yes Constant No CON 0 ' No Constant ' -----[ Variables ]------------------------------------------------------- index VAR Byte ' Index Variable ' -----[ Program Code ]---------------------------------------------------- Main: FOR index = 0 TO 4 LOW LEDK HIGH LEDA DEBUG "LED A High", CR PAUSE 500 LOW LEDA DEBUG "LED A Low", CR PAUSE 500 NEXT FOR index = 0 TO 4 HIGH LEDK DEBUG "LED K High", CR PAUSE 500 LOW LEDK DEBUG "LED K Low", CR PAUSE 500 NEXT FOR index = 0 TO 4 HIGH LEDA DEBUG "LED A High", CR LOW LEDK DEBUG "LED K Low", CR PAUSE 500 HIGH LEDK DEBUG "LED K High", CR LOW LEDA DEBUG "LED A Low", CR PAUSE 500 NEXT LOW LEDK DO IF BTN1 THEN DEBUG "Button 1 Pressed!", CR ELSEIF BTN2 THEN DEBUG "Button 2 Pressed!", CR ENDIF PAUSE 50 LOOP STOP