'-------------------------------------------------------------------------------
Option Explicit

'-------------------------------------------------------------------------------
Public Sub Main()

' BX-24 serial port and LED demonstration.

    Dim Toggle As Boolean

    Toggle = True

    Call Delay(0.5)

    Do
        Debug.Print "Hello, world";

        If (Toggle) Then
            Debug.Print " BX-24";
        End If
        Toggle = Not Toggle

        Debug.Print   ' <CR><LF>
            
        Call BlinkLEDs
        Call Delay(0.5)
    Loop

End Sub
'-------------------------------------------------------------------------------
Private Sub BlinkLEDs()

    Const GreenLED As Byte = 26
    Const RedLED As Byte = 25

    Const LEDon As Byte = 0
    Const LEDoff As Byte = 1

    ' Red pulse.
    Call PutPin(RedLED, LEDon)
    Call Delay(0.07)
    Call PutPin(RedLED, LEDoff)

    Call Delay(0.07)

    ' Green pulse.
    Call PutPin(GreenLED, LEDon)
    Call Delay(0.07)
    Call PutPin(GreenLED, LEDoff)

    Call Delay(0.07)

End Sub
'-------------------------------------------------------------------------------
