Python Radio 24: The BBC Micro:bit
A fun little computer.
The Micro:bit computer from the BBC (yes, the British Broadcasting Company) shown above in its robotic rover carrier, is based on the Nordic nRF52833 processor (an ARM Cortex-M4 32-bit processor with a floating point unit). It has half a megabyte of flash memory for programs and 128k bytes of RAM.
Besides the processor, it has on the board a Nordic S113 SoftDevice Bluetooth Low Energy chip. This is made available to MicroPython as the radio module, which greatly simplifies the use of Bluetooth Low Energy, taking care of all the complicated bits.
For example, here is a program where two Micro:bits send messages to one another:
from microbit import *
import radio
radio.config(group=23, power=7, data_rate=radio.RATE_1MBIT)
radio.on()
count = 0
msg_num = 0
while True:
if count == 50000:
radio.send(’hello ‘ + str(msg_num))
msg_num += 1
count = 0
count += 1
message = radio.receive()
if message:
print(message)
display.scroll(message)
The config() method sets up a group of radios that can communicate with one another (like a channel). It sets the transmit power to the maximum of 4dBm (2.5 milliwatts), and the speed to a megabit per second (maximum is 2 megabits per second, at the expense of range).