micro:bit (and other BLE friends) implementation of the Bleson API

50 views
Skip to first unread message

Wayne Keenan

unread,
Dec 8, 2017, 9:39:18 AM12/8/17
to python-bleson
Hi,

I've implemented a Bleson API POC on a port of MicroPython to Apache MyNewt.

It's very alpha, only supporting very basic Bleson Advertising (name only) on the surface.  Underneath there is central and peripheral support hiding from the earlier project (that's alpha too)

I have uploaded the micro:bit firmware here: https://github.com/TheBubbleworks/micropython-mynewt-firmware


There is currently 64k of flash space free, but there is no filesystem currently exposed to uPY (also the micro:bit libraries aren't currently included), soyou have to paste the script in of the USB serial REPL every power on, for now.
When you do paste if you can use a terminal emulation program that can add inter character delays to 8ms, e.g. CoolTerm available on all the major platforms, you will have more luck pasting text in without characters going missing.

This example from the Bleson online docs is a good start point:

from time import sleep
from bleson import get_default_adapter, Advertiser, Advertisement

adapter
= get_default_adapter()
advertiser
= Advertiser(adapter)
advertisement
= Advertisement()
advertisement
.name = "bleson"

advertiser
.advertisement = advertisement

advertiser
.start()
sleep
(2)
advertiser
.stop()





All the best
Wayne
Reply all
Reply to author
Forward
0 new messages