LEGO Boost and Python

Update: Simpler and newer version: LEGO Boost and Python - CentOS 7.

I've manage to control LEGO Boost using Python.

I've used CentOS 7, BLED112 dongle and pylgbst library.

There are a few command I have to run:

yum install rh-python36
/opt/rh/rh-python36/root/usr/bin/pip install pygatt
/opt/rh/rh-python36/root/usr/bin/pip install https://github.com/undera/pylgbst/archive/0.9.tar.gz
/opt/rh/rh-python36/root/usr/bin/pip install pexpect

now I can run first program (boost1.py):

from pylgbst.movehub import MoveHub

hub = MoveHub()

for device in hub.devices:
    print(device)

using command:

/opt/rh/rh-python36/root/usr/bin/python boost1.py
1
2
55
56
57
50
58
59
60

as you can see, there are list of devices IDs (1, 2, 55, 56, 57, 50, 58, 59, 60).

Let's try to do something (boost2.py):

from pylgbst.movehub import MoveHub, COLOR_RED

hub = MoveHub()

hub.led.set_color(COLOR_RED)

Yes! The LED has been changed to red.

Kommentare

Bitte melden Sie sich Logan oder registrieren Sie sich um kommentieren zu können.

Just my blog...

Mon Di Mi Do Fr Sa So
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
eZ Publish™ copyright © 1999-2025 eZ Systems AS