Sub Process_Globals
Public Serial1 As Serial
Private wifi As ESP8266WiFi
Public Serial1 As Serial
Private rcs As RCSwitch
Private Pino As D1Pins
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Delay(1000)
Log("AppStart")
If wifi.Connect2("SSID", "PASSWORD") Then
Log(wifi.LocalIp)
rcs.Initialize
rcs.enableReceive("rcs_Available",Pino.D2)
Else
Log("Failed to connect to network")
End If
End Sub
private Sub rcs_Available()
Log("Code: ", rcs.ReceivedValue)
Log("Protocol: ", rcs.ReceivedProtocol)
Log("Bit length: ", rcs.ReceivedBitlength)
Log("Delay: ", rcs.ReceivedDelay)
If rcs.ReceivedValue = "CMDA" Then
Log("OI")
End If
rcs.ResetAvailable
End Sub