[Microbit-Python] Transmitting Integers by radio

Nicholas H.Tollervey ntoll at ntoll.org
Mon Dec 19 03:55:25 EST 2016


Hi David,

I notice you're not a subscriber to the list. In order to get responses
to your question please subscribe via the link at the bottom of this email.

In any case, to answer your question, you have two choices:

* Send and decode bytes
(https://microbit-micropython.readthedocs.io/en/latest/radio.html#radio.send_bytes)
* Send and decode a string.

We made the simple string based send/receive available since it's very
simple and child friendly. It's actually a wrapper around the bytes
related methods. In either case you're going to have to convert the int
into something else (and back again). In Python that's simply just
str(10) or int("10") for example.

Hope this helps,

N.


On 18/12/16 16:33, David Booth via Microbit wrote:
> Hi
> I have two micro:bits.  How do I transmit the x axis acceleration i.e. 
> + or –, 0 to 1023 from one micro:bit to a variable x_accel in the other?
> Thank you
> David Booth
> 
> 
> _______________________________________________
> Microbit mailing list
> Microbit at python.org
> https://mail.python.org/mailman/listinfo/microbit
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/microbit/attachments/20161219/2d103e26/attachment.sig>


More information about the Microbit mailing list