Class
make_radio
includes all the functionality of the
Micropyhton radio
module, while being compatible with MakeCode
blocks. When you instansiate the make_radio
all the parameters
of radio.config
are available which make sense. Whilst keeping
the radio configured to work between Micropython and MakeCode. The radio can
be switched .on()
and .off()
with those methods. You
can send a number (integer or float) with method .send_number(number)
.
Send a value pair (a string with a number) with method
.send_value(value, number)
. Or just send a string with the
.send_string(message)
method. Unlike MakeCode blocks with which
in a single program you can only accept one of a number, value pair or a
string. Micropython provides the convenient .receive_packet()
method. The return values are:
if required use the python function
type
to determine the packet
type.
Blocks radio producer
Blocks radio consumer (receive messages)
Blocks radio consumer (receive values)
Blocks radio consumer (receive numbers)
For this to work both Micropython
make_radio
and MakeCode blocks
radio must use the same group
. You must include the block
radio.setGroup()