Attribute VB_Name = "LED_Flash" Option Explicit 'Below will create space called Buffers so the processor can print data to the Download Window in BasicX Public OutBuffer(1 To 50) As Byte Public InBuffer(1 To 50) As Byte 'BLUE TEXT MEANS BasicX CODE. 'Created below are 2 Global Constants to control the LEDs. Public Const LEDOn As Byte = 0 ' bxOutputLow Public Const LEDOff As Byte = 2 ' bxInputTristate Sub Main() 'All programs have ONLY one Sub Main. ' The next three commands established communication with the computer. ' First, it establishes buffers, and then it opens communications ' to transmit the contents to Com 1 at 19200 baud rate. Call OpenQueue(OutBuffer, 50) Call OpenQueue(InBuffer, 50) Call OpenCom(1, 19200, InBuffer, OutBuffer) 'Print out the words "LED FLASH TEST CODE" Call PutQueueStr(OutBuffer, "LED FLASH TEST CODE") 'and then a carriage return Call PutQueueStr(OutBuffer, Chr(13)) 'and line feed Call PutQueueStr(OutBuffer, Chr(10)) ' Below starts a background task that continually checks pins 10 and 15 and flashing the LED accordingly. DO 'When the right bump switch is closed, the GetPin(10) 'will return a 0 If GetPin(10) = 0 Then 'Turn both LEDs off Call PutPin(25, LEDOff) Call PutPin(26, LEDOff) call delay(3.0) 'When the left bump switch is closed, the GetPin(15) 'will return a 0 ElseIf GetPin(15) = 0 Then 'Turn both LEDs on Call PutPin(25, LEDOn) Call PutPin(26, LEDOn) call delay(3.0) End If 'if no switch is closed then alternately flash the red and green LEDs Call PutPin(25, LEDOn) Call PutPin(26, LEDOff) call delay(1.0) Call PutPin(25, LEDOff) Call PutPin(26, LEDOn) call delay(1.0) Loop End Sub 'Main program is now closed ... below would be Subroutines