131 Week 11 - MicroBit radio module Flashcards

1
Q

Radio hardware

A

Micro:bit devices are equipped with a Nordic Semiconductor nRF52833 System on Chip (SoC) which contains a built-in 2.4GHz radio module.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Micro:bit signal strength

A

Strength of the received signal is expressed in
decibels (dB) with respect to 1 mW

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Datagram

A

A datagram is a sequence of bytes (default 32 bytes) that represents a single packet of data. Micro:bits can transmit 1 datagram at a time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Datagram types

A

An array of bytes: uint8_t myArray[10];
A sequence of characters: ManagedString s(“HELLO”);
A packet buffer: PacketBuffer b(16);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Transmitting a datagram

A

Bit.radio.datagram.send(datagram)
Where datagram is any of the datagram types.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Receiving a datagram

A

uBit.radio.datagram.recv()
Should only use .recv() after a MICROBIT_RADIO_EVT_DATAGRAM event has been raised.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Setting up a radio listener

A

uBit.messageBus.listen(MICROBIT_ID_RADIO, MICROBIT_RADIO_EVT_DATAGRAM, onRx);
MICROBIT_ID_RADIO is used to specify to monitor the radio component.
MICROBIT_RADIO_EVT_DATAGRAM is used to raise an event when a
datagram is received
onRx is an example name for an event handler which is called to receive the datagram.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Setting up the radio module

A

Need to enable radio module using: uBit.radio.enable()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Managed string

A

Managed type - automatically reserves and releases memory.
Immutable – cannot be changed once it is created.
Can be compared using ==, < and >.
Created using the syntax:
ManagedString stringName(“String Contents”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Joining managed strings

A

Although they cannot be changed, 2 managed strings can be joined to create a new string:
ManagedString greeting(“HAPPY NEW YEAR “);
ManagedString year(2024);
ManagedString msg = greeting + year;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Packet buffer

A

Managed type - automatically reserves and releases memory.
Created using syntax:
PacketBuffer bufferName(numBytes); where numBytes is an integer representing how many bytes the packet buffer will store.
Can be read from or written to once created using square bracket notation:
b[0] = 255;
b[1] = 10;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Useful methods

A

uBit.radio.setGroup(int) sets a group. Only other microbits in that group will receive datagrams. Default group is 0.
uBit.radio.enable() initialises the radio component of micro:bit for transmission/reception.
uBit.radio.disable() disables radio component for use as a multipoint sender/receiver.
datagramName.getRSSI() retrieves the received signal strength indicator (RSSI), which is measured in dBm, of the most recently received datagram.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly