radio bridge activity (#1221)

This commit is contained in:
Peli de Halleux 2018-09-12 21:44:19 -07:00 committed by GitHub
parent eae6e5a6be
commit 42e60645a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 0 deletions

View File

@ -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

View 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)
```

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB