[Microbit-Python] Sending an integer by radio

David Booth david.f.booth at googlemail.com
Mon Dec 19 09:14:55 EST 2016


Hi Mark
Nicholas Tollervey has just told me why my script does not work and
provided me with the following
What's the solution..? It's easy, you simply need to keep polling until
a message is received:

import radio
radio.on()

msg = None
while not msg:
  msg = radio.receive()

my_number = int(msg)

Have a happy Christmas
David

On 19 December 2016 at 11:25, Mark Shannon <mark at hotpy.org> wrote:

> Hi David,
>
> Just convert the integer value to a string and then send that.
> send:
> radio.send(str(x_accel))
> receive:
> x_accel = int(radio.recv())
>
> Mark.
>
> On 18/12/16 16:36, David Booth via Microbit wrote:
>
>> Hi
>> I have two micro:bits.  How do I send the x acceleration (i.e.+/- 0 to
>> 1023) from one to a variable x_accel on the other by radio?
>>
>> Thank you
>> David
>>
>>
>> _______________________________________________
>> Microbit mailing list
>> Microbit at python.org
>> https://mail.python.org/mailman/listinfo/microbit
>>
>> _______________________________________________
> Microbit mailing list
> Microbit at python.org
> https://mail.python.org/mailman/listinfo/microbit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/microbit/attachments/20161219/254cac7e/attachment-0001.html>


More information about the Microbit mailing list