IS5451
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

35 lines
992 B

radio.onReceivedString(function (receivedString) {
if (receivedString == "handshake") {
//basic.showString("H")
if (state == 0) {
state = 1
radio.sendString("enrol=" + control.deviceName())
}
} else {
if (state == 1) {
buffer = receivedString.split("=")
commandKey = buffer[0]
commandValue = buffer[1]
if (commandKey == "sensor") {
//basic.showString("S")
if (commandValue == "light") {
radio.sendString("" + control.deviceName() + "=" + pins.analogReadPin(AnalogPin.P0))
}
}
}
}
})
let commandValue = ""
let commandKey = ""
let buffer: string[] = []
let state = 0
radio.setGroup(8)
radio.setTransmitPower(7)
radio.setTransmitSerialNumber(true)
basic.showIcon(IconNames.Yes)
basic.forever(function () {
led.plotBarGraph(
pins.analogReadPin(AnalogPin.P0),
650
)
})