I have two micro:bit's: 'mb1' and 'mb2'.
- mb2 count steps and measures time.
- mb1 starts these processes on mb2 by sending a radio signal as a string, and after ten seconds mb1 receives a radio signal from mb2, which contains a numerical value ( the counted steps ) which is an integer type. After the value was received, mb1 is doing some mathematical operations with that number of steps and other constants.
I am currently using this code to achieve this goal:
on mb2:
Code: Select all
radio.send(str(step))
Code: Select all
while True:
receivedSignal = radio.receive()
if receivedSignal is not None:
break
else:
display.show(anotherImage)
steps = int(receivedSignal) * 2
Maybe the 'radio.send_bytes(message)' and 'radio.receive_bytes()' are what I want?
If yes, please give me an example how to use these functions to send a numerical value of a variable?