2016-03-26 00:47:20 +01:00
|
|
|
# Set Group
|
|
|
|
|
2016-06-02 02:11:28 +02:00
|
|
|
Make a program have the group ID you tell it for sending and receiving
|
|
|
|
with ``radio``. A group is like a cable channel (a micro:bit can only
|
|
|
|
send or receive in one group at a time). A group ID is like the cable
|
|
|
|
channel number.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-06-02 02:11:28 +02:00
|
|
|
If you do not tell your program which group ID to use with this
|
|
|
|
function, it will figure out its own group ID by itself. If you load
|
|
|
|
the very same program onto two different micro:bits, they will be able
|
|
|
|
to talk to each other because they will have the same group ID.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
2016-06-02 02:11:28 +02:00
|
|
|
* ``id`` is a [number](/reference/types/number) from ``0`` to ``255``.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-06-10 00:30:47 +02:00
|
|
|
### Simulator
|
|
|
|
|
|
|
|
This function only works on the micro:bit, not in browsers.
|
|
|
|
|
2016-03-26 00:47:20 +01:00
|
|
|
### Example
|
|
|
|
|
2016-06-02 02:11:28 +02:00
|
|
|
This program makes the group ID equal 128.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
```blocks
|
|
|
|
radio.setGroup(128)
|
|
|
|
```
|
|
|
|
|
|
|
|
### See also
|
|
|
|
|
2016-04-16 00:02:26 +02:00
|
|
|
[receive number](/reference/radio/receive-number), [send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)
|
2016-03-26 00:47:20 +01:00
|
|
|
|