Public Sub Connect
admin.StartDiscovery
connecting = True
CallSub(Main, "SetState")
End Sub
Private Sub admin_DeviceFound (Name As String, MacAddress As String)
Log($"Device found: ${Name}"$)
If Name = "HC-05" Then
Log("Trying to connect...")
admin.CancelDiscovery
serial.Connect(MacAddress)
End If
End Sub
Private Sub admin_DiscoveryFinished
connecting = False
End Sub