radio bridge activity (#1221)
This commit is contained in:
parent
eae6e5a6be
commit
42e60645a2
@ -45,6 +45,7 @@
|
||||
* [Servo calibrator](/projects/servo-calibrator)
|
||||
* [Analog Pin Tester](/projects/analog-pin-tester)
|
||||
* [Light Level Meter](/projects/light-level-meter)
|
||||
* [Radio bridge](/projects/radio-bridge)
|
||||
|
||||
## #examples
|
||||
|
||||
|
36
docs/projects/radio-bridge.md
Normal file
36
docs/projects/radio-bridge.md
Normal file
@ -0,0 +1,36 @@
|
||||
# Radio bridge
|
||||
|
||||
```typescript
|
||||
/**
|
||||
* 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.onDataPacketReceived(function () {
|
||||
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)
|
||||
```
|
@ -23,3 +23,15 @@
|
||||
"cardType": "side"
|
||||
}]
|
||||
```
|
||||
|
||||
## Streaming
|
||||
|
||||
```codecard
|
||||
[{
|
||||
"name": "Radio Bridge",
|
||||
"description": "Send radio messages to editor",
|
||||
"url": "/projects/radio-bridge",
|
||||
"imageUrl": "/static/mb/projects/radio-bridge.png",
|
||||
"cardType": "example"
|
||||
}]
|
||||
```
|
BIN
docs/static/mb/projects/radio-bridge.png
vendored
Normal file
BIN
docs/static/mb/projects/radio-bridge.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
Loading…
Reference in New Issue
Block a user