Sub Process_Globals
Public Serial1 As Serial
Private timer1 As Timer
Private master As WireMaster
Private const SLAVE_ADDRESS As Byte = 8
Private led13 As Pin
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
master.Initialize
led13.Initialize(13, led13.MODE_OUTPUT)
led13.DigitalWrite(True)
timer1.Initialize("Timer1_Tick", 10)
timer1.Enabled = True
End Sub
Sub Timer1_Tick
master.WriteTo(SLAVE_ADDRESS, NumberFormat(Millis, 0, 0).GetBytes)
Dim b() As Byte = master.RequestFrom(SLAVE_ADDRESS, 1)
If b.Length = 1 Then
Dim state As Boolean
If b(0) = 0 Then state = False Else state = True
led13.DigitalWrite(state)
End If
End Sub