2b504d863d
* a few updates * more updates * reorder radio blocks * more shuffling of new radio apis * fixing hot or ocold * more doc fixes * more updates * fixing docs issues * more doc fixes * restore docs errors * missing packate * renamed argument of callback * mssing radio * more odcs fixes * lock turtle * ignore docs for now
982 B
982 B
Radio bridge
Transfer the packet data received from the radio to the serial port. Use buttons A and B to select a radio group number.
/**
* Download this code and connect the device to the computer.
* Press A and B to select the radio group or change it in the code.
*/
let group = 0
/**
* Send all received packets to serial output
*/
radio.onReceivedNumber(function (receivedNumber) {
radio.writeReceivedPacketToSerial()
led.toggle(Math.randomRange(0, 4), Math.randomRange(0, 4))
})
/**
* Decrement radio group by 1
*/
input.onButtonPressed(Button.A, function () {
group = Math.max(0, group - 1)
radio.setGroup(group)
led.stopAnimation()
basic.showNumber(group)
})
/**
* Increment radio group by 1
*/
input.onButtonPressed(Button.B, function () {
group = Math.min(255, group + 1)
radio.setGroup(group)
led.stopAnimation()
basic.showNumber(group)
})
group = 128
radio.setGroup(group)
radio