2019-12-02 05:58:26 +01:00
|
|
|
# send Number
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
Broadcast a [number](/types/number) to other @boardname@s connected via ``radio``.
|
2016-07-18 23:04:15 +02:00
|
|
|
|
|
|
|
```sig
|
|
|
|
radio.sendNumber(0);
|
|
|
|
```
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## Parameters
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
* **value**: a [number](/types/number) to send.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## ~ hint
|
2016-06-10 00:30:47 +02:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
Watch this video to see how the radio hardware works on the @boardname@:
|
|
|
|
|
|
|
|
https://www.youtube.com/watch?v=Re3H2ISfQE8
|
|
|
|
|
|
|
|
## ~
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
### Broadcasting acceleration
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-11-02 01:44:37 +01:00
|
|
|
This example broadcasts the value of your @boardname@'s ``acceleration``
|
|
|
|
in the `x` direction (left and right) to other @boardname@s. This kind
|
2016-07-18 23:04:15 +02:00
|
|
|
of program might be useful in a model car or model rocket.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
```blocks
|
2022-04-26 19:28:42 +02:00
|
|
|
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
2016-03-26 00:47:20 +01:00
|
|
|
radio.sendNumber(input.acceleration(Dimension.X))
|
|
|
|
})
|
|
|
|
```
|
|
|
|
|
2016-05-28 01:22:38 +02:00
|
|
|
### Light level sender
|
|
|
|
|
2016-06-01 02:02:22 +02:00
|
|
|
This example broadcasts the level of the light around it.
|
|
|
|
You can do some interesting things with it if you use it along with the
|
2019-12-02 05:58:26 +01:00
|
|
|
[on received number](/reference/radio/on-received-number) example.
|
2016-05-28 01:22:38 +02:00
|
|
|
|
|
|
|
```blocks
|
|
|
|
radio.setGroup(99)
|
|
|
|
basic.forever(() => {
|
|
|
|
let level = input.lightLevel()
|
|
|
|
radio.sendNumber(level)
|
|
|
|
})
|
|
|
|
```
|
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## See also
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
[on received number](/reference/radio/on-received-number)
|
2016-08-09 17:28:08 +02:00
|
|
|
|
|
|
|
```package
|
2016-10-23 06:29:31 +02:00
|
|
|
radio
|
2016-08-09 17:28:08 +02:00
|
|
|
```
|