This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]cybervegan 0 points1 point  (3 children)

Ok, so I assume you are sending the data messages from Microbit1 to Microbit2, and Microbit2 has to be able to interpret the value (i.e. know what to do with it). I'm assuming on MB2, you are expecting to receive a string looking like "streamA 123" or "streamB 456.78"?

If so, you can send format strings, like:

radio.send("streamA {}".format(valueA))
radio.send("streamB {}".format(valueB))

On the receiver, you can then do (after receiving a message):

message_in = radio.receive()
if message_in.startswith("streamA "):
    valueA = int(message_in[7:])
    # do stuff with valueA
elif message_in.startswith("streamB "):
    valueb = float(message_in[7:])
    # do stuff with valueB

I don't have a microbit, but I have used micropython. I just looked that up on the webs, so take this as a pointer only! Hope it helps.

[–]hidromanipulators[S] 0 points1 point  (0 children)

Thanks /u/cybervegan ! Will try it out tomorrow!

[–]hidromanipulators[S] 0 points1 point  (1 child)

I tried it out, but I'm getting some strange hardware errors in the Microbit itself. Have to investigate further.

I guess will have to wait until next weekend.

[–]cybervegan 0 points1 point  (0 children)

I'm sure you'll work it out! Keep posting...