virantha / bricknil

Control LEGO Bluetooth Sensors and Motors with Python
https://virantha.github.io/bricknil
Apache License 2.0
141 stars 39 forks source link

Problems with installation and usage on Windows 10, Ubuntu, Raspbian #12

Open gnbl opened 4 years ago

gnbl commented 4 years ago

Summary:


On Windows 10 with the latest Python 3.8.1, pip3 install bricknil (following https://virantha.github.io/bricknil/readme.html#installation) fails when installing pythonnet due to missing dependency wheel. pip3 install wheel resolves that, but building fails due to ModuleNotFoundError: No module named 'pycparser'. pip3 install pycparser solves that, but building fails.

Digging deeper:

https://pypi.org/project/pythonnet/#files last wheel release from mid 2019, so Python 3.7 needed, e.g.

https://www.python.org/ftp/python/3.7.6/python-3.7.6.exe

>%localappdata%\Programs\Python\Python37-32\Scripts\pip3.7.exe install pythonnet
>%localappdata%\Programs\Python\Python37-32\Scripts\pip3.7.exe install bricknil

works.

Then, running https://virantha.github.io/bricknil/readme.html#using-the-duplo-train-and-playing-sounds as brick.py:

Traceback (most recent call last):
  File "brick.py", line 70, in <module>
    start(system)
  File "%localappdata%\Programs\Python\Python37-32\lib\site-packages\bricknil\bricknil.py", line 207, in start
    from .bleak_interface import Bleak
  File "%localappdata%\Programs\Python\Python37-32\lib\site-packages\bricknil\bleak_interface.py", line 20, in <module>
    import bleak
  File "%localappdata%\Programs\Python\Python37-32\lib\site-packages\bleak\__init__.py", line 68, in <module>
    from bleak.backends.dotnet.discovery import discover  # noqa
  File "%localappdata%\Programs\Python\Python37-32\lib\site-packages\bleak\backends\dotnet\discovery.py", line 17, in <module>
    from Windows.Devices.Bluetooth.Advertisement import BluetoothLEAdvertisementWatcher
ModuleNotFoundError: No module named 'Windows'

Google finds this issue and solution: https://github.com/hbldh/bleak/issues/53#issuecomment-473875499

i.e. %localappdata%\Programs\Python\Python37-32\Scripts\bleak-lescan runs without error, albeit not giving any output.

The bricknil example does not find anything (Android nrF Connect has no issue connecting to the train) and "crashes":

Awaiting on bleak discover
Done Awaiting on bleak discover
INFO:BLE Event Q.0:Rescanning for 00001623-1212-efde-1623-785feabcd123 (1 tries left)
ERROR:curio.kernel:Task Crash: Task(id=6, name='BLEventQ.connect', state='TERMINATED')
Traceback (most recent call last):
...

curio.errors.TaskError: Task crash

which I cannot quit (CTRL+C or anything else).

So my Bluetooth 4.0 dongle (CSR) and Windows likely are the actual problem.

https://www.lego.com/en-us/service/device-guide/duplo-connected-train

Bluetooth low power technology (Bluetooth 4.1 or higher)

Although BLE is part of Bluetooth since 4.0!?

I'll try this on Linux.


Same error on Timeout in Ubuntu:

error.txt


Issue with bluetooth adapter ("dongle")?

~$ lsusb
Bus 001 Device 007: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

user@desktop-ubuntu:~$ hcitool dev
Devices:
    hci0    00:0x:xx:xx:xx:xx
user@desktop-ubuntu:~$ sudo hcitool lescan
Set scan parameters failed: Input/output error

user@desktop-ubuntu:~$ hciconfig
hci0:   Type: Primary  Bus: USB
    BD Address: 00:xx:xx:xx:xx:xx  ACL MTU: 310:10  SCO MTU: 64:8
    UP RUNNING 
    RX bytes:2417 acl:0 sco:0 events:150 errors:0
    TX bytes:2168 acl:0 sco:0 commands:121 errors:0

user@desktop-ubuntu:~$ hciconfig -a hci0
hci0:   Type: Primary  Bus: USB
    BD Address: 00:xx:xx:xx:xx:xx  ACL MTU: 310:10  SCO MTU: 64:8
    UP RUNNING 
    RX bytes:2417 acl:0 sco:0 events:150 errors:0
    TX bytes:2168 acl:0 sco:0 commands:121 errors:0
    Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
    Link policy: RSWITCH HOLD SNIFF PARK 
    Link mode: SLAVE ACCEPT 
    Name: 'desktop-ubuntu'
    Class: 0x1c0104
    Service Classes: Rendering, Capturing, Object Transfer
    Device Class: Computer, Desktop workstation
    HCI Version: 2.0 (0x3)  Revision: 0xc5c
    LMP Version: 2.0 (0x3)  Subversion: 0xc5c
    Manufacturer: Cambridge Silicon Radio (10)

So it seems it's only a Bluetooth 2.0 Dongle and does not support BLE... Argh!


Trying on RPi Zero W with current Raspbian Lite:

sudo apt update
pi@raspberrypi:~ $ hciconfig
hci0:   Type: Primary  Bus: UART
        BD Address: xx:xx:xx:xx:xx:xx  ACL MTU: 1021:8  SCO MTU: 64:1
        UP RUNNING
        RX bytes:1385 acl:0 sco:0 events:77 errors:0
        TX bytes:2174 acl:0 sco:0 commands:77 errors:0

pi@raspberrypi:~ $ hciconfig -a hci0
hci0:   Type: Primary  Bus: UART
        BD Address: xx:xx:xx:xx:xx:xx  ACL MTU: 1021:8  SCO MTU: 64:1
        UP RUNNING
        RX bytes:1385 acl:0 sco:0 events:77 errors:0
        TX bytes:2174 acl:0 sco:0 commands:77 errors:0
        Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
        Link policy: RSWITCH SNIFF
        Link mode: SLAVE ACCEPT
        Name: 'raspberrypi'
        Class: 0x000000
        Service Classes: Unspecified
        Device Class: Miscellaneous,
        HCI Version: 4.1 (0x7)  Revision: 0x168
        LMP Version: 4.1 (0x7)  Subversion: 0x2209
        Manufacturer: Broadcom Corporation (15)

pi@raspberrypi:~ $ sudo hcitool lescan
LE Scan ...
xx:xx:xx:xx:xx:xx (unknown)
...
18:04:ED:EB:FB:BB Train Base
...
xx:xx:xx:xx:xx:xx (unknown)
^C

sudo apt install python3-pip
pip install bricknil
pi@raspberrypi:~ $ nano brick.py
(paste example code)
pi@raspberrypi:~ $ python3 brick.py
started thread for curio
inside curio run loop
INFO:BLE Event Q.0:using bleak
INFO:BLE Event Q.0:Starting scan for UART 00001623-1212-efde-1623-785feabcd123
INFO:BLE Event Q.0:Looking for first matching hub
Awaiting on bleak discover
Traceback (most recent call last):
  File "brick.py", line 70, in <module>
    start(system)
  File "/home/pi/.local/lib/python3.7/site-packages/bricknil/bricknil.py", line 214, in start
    ble.run()
  File "/home/pi/.local/lib/python3.7/site-packages/bricknil/bleak_interface.py", line 52, in run
    self.loop.run_until_complete(self.asyncio_loop())
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "/home/pi/.local/lib/python3.7/site-packages/bricknil/bleak_interface.py", line 65, in asyncio_loop
    devices = await bleak.discover(timeout=1, loop=self.loop)
  File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/discovery.py", line 100, in discover
    loop
txdbus.error.RemoteError: org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.13" (uid=1000 pid=1487 comm="python3 brick.py ") interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" error name="(unset)" requested_reply="0" destination="org.bluez" (uid=0 pid=359 comm="/usr/lib/bluetooth/bluetoothd ")
^CException ignored in: <module 'threading' from '/usr/lib/python3.7/threading.py'>
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 1281, in _shutdown
    t.join()
  File "/usr/lib/python3.7/threading.py", line 1032, in join
    self._wait_for_tstate_lock()
  File "/usr/lib/python3.7/threading.py", line 1048, in _wait_for_tstate_lock
    elif lock.acquire(block, timeout):
KeyboardInterrupt

pi@raspberrypi:~ $ sudo python3 brick.py
Traceback (most recent call last):
  File "brick.py", line 2, in <module>
    from curio import sleep
ModuleNotFoundError: No module named 'curio'

pi@raspberrypi:~ $ ls /etc/dbus-1/system.d/
avahi-dbus.conf  bluetooth.conf  wpa_supplicant.conf
pi@raspberrypi:~ $ sudo nano /etc/dbus-1/system.d/bluetooth.conf
pi@raspberrypi:~ $ groups
pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi
pi@raspberrypi:~ $ sudo adduser pi bluetooth
Adding user `pi' to group `bluetooth' ...
Adding user pi to group bluetooth
Done.

pi@raspberrypi:~ $ python3 brick.py
started thread for curio
inside curio run loop
INFO:BLE Event Q.0:using bleak
INFO:BLE Event Q.0:Starting scan for UART 00001623-1212-efde-1623-785feabcd123
INFO:BLE Event Q.0:Looking for first matching hub
Awaiting on bleak discover
Traceback (most recent call last):
  File "brick.py", line 70, in <module>
    start(system)
  File "/home/pi/.local/lib/python3.7/site-packages/bricknil/bricknil.py", line 214, in start
    ble.run()
  File "/home/pi/.local/lib/python3.7/site-packages/bricknil/bleak_interface.py", line 52, in run
    self.loop.run_until_complete(self.asyncio_loop())
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "/home/pi/.local/lib/python3.7/site-packages/bricknil/bleak_interface.py", line 65, in asyncio_loop
    devices = await bleak.discover(timeout=1, loop=self.loop)
  File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/discovery.py", line 100, in discover
    loop
txdbus.error.RemoteError: org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.13" (uid=1000 pid=557 comm="python3 brick.py ") interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" error name="(unset)" requested_reply="0" destination="org.bluez" (uid=0 pid=351 comm="/usr/lib/bluetooth/bluetoothd ")

Following

https://raspberrypi.stackexchange.com/questions/71333/bluetooth-does-not-work-with-raspbian-stretch-and-raspberry-pi-3

seems to fix the access problem, but there is another Exception:


pi@raspberrypi:~ $ busctl tree org.bluez
Failed to introspect object / of service org.bluez: Access denied
No objects discovered.
pi@raspberrypi:~ $ sudo busctl tree org.bluez
ââ/org
  ââ/org/bluez
    ââ/org/bluez/hci0
pi@raspberrypi:~ $ sudo adduser pi bluetooth
The user `pi' is already a member of `bluetooth'.
pi@raspberrypi:~ $ newgrp bluetooth
pi@raspberrypi:~ $ busctl tree org.bluez
Failed to introspect object / of service org.bluez: Access denied
No objects discovered.

pi@raspberrypi:~ $ systemctl status bluetooth
â bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-01-22 13:00:21 GMT; 12min ago
     Docs: man:bluetoothd(8)
 Main PID: 351 (bluetoothd)
   Status: "Running"
   Memory: 2.6M
   CGroup: /system.slice/bluetooth.service
           ââ351 /usr/lib/bluetooth/bluetoothd

Jan 22 13:00:21 raspberrypi systemd[1]: Starting Bluetooth service...
Jan 22 13:00:21 raspberrypi bluetoothd[351]: Bluetooth daemon 5.50
Jan 22 13:00:21 raspberrypi systemd[1]: Started Bluetooth service.
Jan 22 13:00:21 raspberrypi bluetoothd[351]: Starting SDP server
Jan 22 13:00:21 raspberrypi bluetoothd[351]: Bluetooth management interface 1.14 initialized
Jan 22 13:00:21 raspberrypi bluetoothd[351]: Sap driver initialization failed.
Jan 22 13:00:21 raspberrypi bluetoothd[351]: sap-server: Operation not permitted (1)
Jan 22 13:00:21 raspberrypi bluetoothd[351]: Failed to set privacy: Rejected (0x0b)
pi@raspberrypi:~ $ sudo systemctl status bluetooth
â bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-01-22 13:00:21 GMT; 12min ago
     Docs: man:bluetoothd(8)
 Main PID: 351 (bluetoothd)
   Status: "Running"
   Memory: 2.6M
   CGroup: /system.slice/bluetooth.service
           ââ351 /usr/lib/bluetooth/bluetoothd

Jan 22 13:00:21 raspberrypi systemd[1]: Starting Bluetooth service...
Jan 22 13:00:21 raspberrypi bluetoothd[351]: Bluetooth daemon 5.50
Jan 22 13:00:21 raspberrypi systemd[1]: Started Bluetooth service.
Jan 22 13:00:21 raspberrypi bluetoothd[351]: Starting SDP server
Jan 22 13:00:21 raspberrypi bluetoothd[351]: Bluetooth management interface 1.14 initialized
Jan 22 13:00:21 raspberrypi bluetoothd[351]: Sap driver initialization failed.
Jan 22 13:00:21 raspberrypi bluetoothd[351]: sap-server: Operation not permitted (1)
Jan 22 13:00:21 raspberrypi bluetoothd[351]: Failed to set privacy: Rejected (0x0b)
pi@raspberrypi:~ $ sudo reboot

pi@raspberrypi:~ $ busctl tree org.bluez
ââ/org
  ââ/org/bluez
    ââ/org/bluez/hci0
pi@raspberrypi:~ $ python3 brick.py
started thread for curio
inside curio run loop
INFO:BLE Event Q.0:using bleak
INFO:BLE Event Q.0:Starting scan for UART 00001623-1212-efde-1623-785feabcd123
INFO:BLE Event Q.0:Looking for first matching hub
Awaiting on bleak discover
Done Awaiting on bleak discover
INFO:BLE Event Q.0:Rescanning for 00001623-1212-efde-1623-785feabcd123 (60 tries left)
Awaiting on bleak discover
Done Awaiting on bleak discover
INFO:BLE Event Q.0:Rescanning for 00001623-1212-efde-1623-785feabcd123 (59 tries left)
Awaiting on bleak discover
Unhandled Error
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/txdbus/protocol.py", line 140, in dataReceived
    self.rawDBusMessageReceived(raw_msg)
  File "/home/pi/.local/lib/python3.7/site-packages/txdbus/protocol.py", line 266, in rawDBusMessageReceived
    self.signalReceived(m)
  File "/home/pi/.local/lib/python3.7/site-packages/txdbus/client.py", line 642, in signalReceived
    self.router.routeMessage(msig)
  File "/home/pi/.local/lib/python3.7/site-packages/txdbus/router.py", line 128, in routeMessage
    r.match(m)
--- <exception caught here> ---
  File "/home/pi/.local/lib/python3.7/site-packages/txdbus/router.py", line 67, in match
    self.callback(m)
  File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/discovery.py", line 65, in parse_msg
    device_interface = message.body[1].get("org.bluez.Device1", {})
builtins.AttributeError: 'list' object has no attribute 'get'

Unhandled Error
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/txdbus/protocol.py", line 140, in dataReceived
    self.rawDBusMessageReceived(raw_msg)
  File "/home/pi/.local/lib/python3.7/site-packages/txdbus/protocol.py", line 266, in rawDBusMessageReceived
    self.signalReceived(m)
  File "/home/pi/.local/lib/python3.7/site-packages/txdbus/client.py", line 642, in signalReceived
    self.router.routeMessage(msig)
  File "/home/pi/.local/lib/python3.7/site-packages/txdbus/router.py", line 128, in routeMessage
    r.match(m)
--- <exception caught here> ---
  File "/home/pi/.local/lib/python3.7/site-packages/txdbus/router.py", line 67, in match
    self.callback(m)
  File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/discovery.py", line 65, in parse_msg
    device_interface = message.body[1].get("org.bluez.Device1", {})
builtins.AttributeError: 'list' object has no attribute 'get'

Unhandled Error
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/txdbus/protocol.py", line 140, in dataReceived
    self.rawDBusMessageReceived(raw_msg)
  File "/home/pi/.local/lib/python3.7/site-packages/txdbus/protocol.py", line 266, in rawDBusMessageReceived
    self.signalReceived(m)
  File "/home/pi/.local/lib/python3.7/site-packages/txdbus/client.py", line 642, in signalReceived
    self.router.routeMessage(msig)
  File "/home/pi/.local/lib/python3.7/site-packages/txdbus/router.py", line 128, in routeMessage
    r.match(m)
--- <exception caught here> ---
  File "/home/pi/.local/lib/python3.7/site-packages/txdbus/router.py", line 67, in match
    self.callback(m)
  File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/discovery.py", line 65, in parse_msg
    device_interface = message.body[1].get("org.bluez.Device1", {})
builtins.AttributeError: 'list' object has no attribute 'get'

Traceback (most recent call last):
  File "brick.py", line 70, in <module>
    start(system)
  File "/home/pi/.local/lib/python3.7/site-packages/bricknil/bricknil.py", line 214, in start
    ble.run()
  File "/home/pi/.local/lib/python3.7/site-packages/bricknil/bleak_interface.py", line 52, in run
    self.loop.run_until_complete(self.asyncio_loop())
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "/home/pi/.local/lib/python3.7/site-packages/bricknil/bleak_interface.py", line 65, in asyncio_loop
    devices = await bleak.discover(timeout=1, loop=self.loop)
  File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/discovery.py", line 167, in discover
    returnSignature='a{sv}').asFuture(loop)
txdbus.error.RemoteError: org.freedesktop.DBus.Error.UnknownObject: Method "GetAll" with signature "s" on interface "org.freedesktop.DBus.Properties" doesn't exist
gnbl commented 4 years ago

So I've just seen https://virantha.github.io/bricknil/readme.html#installation and https://virantha.github.io/bricknil/pi_setup.html

I've reinstalled bricknil with sudo and the above error does not occur. However, nothing happens when I spin the front wheels manually.

pi@raspberrypi:~ $ sudo python3 brick.py
started thread for curio
inside curio run loop
INFO:BLE Event Q.0:using bleak
INFO:BLE Event Q.0:Starting scan for UART 00001623-1212-efde-1623-785feabcd123
INFO:BLE Event Q.0:Looking for first matching hub
Awaiting on bleak discover
Done Awaiting on bleak discover
INFO:BLE Event Q.0:checking manufacturer ID for device named Train Base for Train Base
INFO:BLE Event Q.0:found device Train Base
INFO:BLE Event Q.0:Device advertised: {'00001624-1212-efde-1623-785feabcd123': {'UUID': '00001624-1212-efde-1623-785feabcd123', 'Service': '/org/bluez/hci0/dev_18_04_ED_EB_FB_BB/service0009', 'Value': [10, 0, 70, 19, 0, 2, 140, 0, 0, 0], 'Notifying': False, 'Flags': ['write-without-response', 'write', 'notify'], 'WriteAcquired': False, 'NotifyAcquired': False, 'Path': '/org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx/service0009/char000a'}}
INFO:BLE Event Q.0:Connected to device Train Base:xx:xx:xx:xx:xx:xx
INFO:train.5:Waiting for peripheral motor to attach to a port
INFO:train.5:Waiting for peripheral motor to attach to a port
INFO:speed_sensor.3:ASSIGNING PORT 19 on speed_sensor
INFO:train.5:Movement detected: starting...
INFO:train.5:Speed sensor changed speed: 133
INFO:train.5:Speed sensor changed speed: 134
INFO:train.5:Speed sensor changed speed: 135
INFO:train.5:Waiting for peripheral motor to attach to a port
INFO:train.5:Speed sensor changed speed: 0
INFO:train.5:Waiting for peripheral motor to attach to a port
INFO:train.5:Waiting for peripheral motor to attach to a port
INFO:train.5:Waiting for peripheral motor to attach to a port
INFO:train.5:Waiting for peripheral motor to attach to a port
^CTraceback (most recent call last):
  File "brick.py", line 70, in <module>
    start(system)
  File "/usr/local/lib/python3.7/dist-packages/bricknil/bricknil.py", line 214, in start
    ble.run()
  File "/usr/local/lib/python3.7/dist-packages/bricknil/bleak_interface.py", line 52, in run
    self.loop.run_until_complete(self.asyncio_loop())
  File "/usr/lib/python3.7/asyncio/base_events.py", line 571, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.7/asyncio/base_events.py", line 539, in run_forever
    self._run_once()
  File "/usr/lib/python3.7/asyncio/base_events.py", line 1739, in _run_once
    event_list = self._selector.select(timeout)
  File "/usr/lib/python3.7/selectors.py", line 468, in select
    fd_event_list = self._selector.poll(timeout, max_ev)
KeyboardInterrupt
INFO:train.5:Waiting for peripheral motor to attach to a port
INFO:train.5:Waiting for peripheral motor to attach to a port
INFO:train.5:Waiting for peripheral motor to attach to a port
^CException ignored in: <module 'threading' from '/usr/lib/python3.7/threading.py'>
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 1281, in _shutdown
    t.join()
  File "/usr/lib/python3.7/threading.py", line 1032, in join
    self._wait_for_tstate_lock()
  File "/usr/lib/python3.7/threading.py", line 1048, in _wait_for_tstate_lock
    elif lock.acquire(block, timeout):
KeyboardInterrupt

The sample code says the hub button needs to be pushed, which turns off the train.


INFO:BLE Event Q.0:Connected to device Train Base:xx:xx:xx:xx:xx:xx
INFO:train.5:Waiting for peripheral motor to attach to a port
INFO:train.5:Waiting for peripheral motor to attach to a port
INFO:vision_sensor.1:ASSIGNING PORT 18 on vision_sensor
INFO:speed_sensor.3:ASSIGNING PORT 19 on speed_sensor
INFO:train.5:Waiting for peripheral motor to attach to a port
INFO:train.5:Waiting for peripheral motor to attach to a port
INFO:train.5:Waiting for peripheral motor to attach to a port

Ok so I got it to work once by connecting, shutting down the train when connected, starting the train again. But I can't reproduce.

gnbl commented 4 years ago

Got a Bluetooth 4.0 dongle, and it starts working on Windows, although the Bricknil commands seem to be interrupted by the train:

>py -3.7 brick.py
started thread for curio
inside curio run loop
INFO:BLE Event Q.0:using bleak
INFO:BLE Event Q.0:Starting scan for UART 00001623-1212-efde-1623-785feabcd123
INFO:BLE Event Q.0:Looking for first matching hub
Awaiting on bleak discover
Done Awaiting on bleak discover
INFO:BLE Event Q.0:Rescanning for 00001623-1212-efde-1623-785feabcd123 (60 tries left)
Awaiting on bleak discover
Done Awaiting on bleak discover
INFO:BLE Event Q.0:Rescanning for 00001623-1212-efde-1623-785feabcd123 (59 tries left)
Awaiting on bleak discover
Done Awaiting on bleak discover
INFO:BLE Event Q.0:Rescanning for 00001623-1212-efde-1623-785feabcd123 (58 tries left)
Awaiting on bleak discover
Done Awaiting on bleak discover
INFO:BLE Event Q.0:checking manufacturer ID for device named Unknown for Train Base
INFO:BLE Event Q.0:found device Unknown
INFO:BLE Event Q.0:Device advertised: {'00001624-1212-efde-1623-785feabcd123': <Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic object at 0x03A56650>, '00002a00-0000-1000-8000-00805f9b34fb': <Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic object at 0x03A56850>, '00002a01-0000-1000-8000-00805f9b34fb': <Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic object at 0x03A56B30>, '00002a04-0000-1000-8000-00805f9b34fb': <Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic object at 0x03A565B0>}
INFO:BLE Event Q.0:Connected to device Bluetooth xx:xx:xx:xx:xx:xx:XX:XX:XX:XX:XX:XX
INFO:train.5:Waiting for peripheral motor to attach to a port
INFO:train.5:Waiting for peripheral motor to attach to a port
INFO:motor.4:ASSIGNING PORT 0 on motor
INFO:led.2:ASSIGNING PORT 17 on led
INFO:vision_sensor.1:ASSIGNING PORT 18 on vision_sensor
INFO:speed_sensor.3:ASSIGNING PORT 19 on speed_sensor
INFO:BLE Event Q.0:Waiting for hubs to end
INFO:train.5:Running
INFO:train.5:Please move the train to start the program
INFO:train.5:Movement detected: starting...
INFO:train.5:Speed sensor changed speed: 90
INFO:train.5:Set speed to 0
INFO:motor.4:Setting speed to 0
INFO:train.5:Speed sensor changed speed: 125
INFO:train.5:Speed sensor changed speed: 148
INFO:motor.4:Setting speed to 1
INFO:train.5:Speed sensor changed speed: 4
INFO:train.5:Speed sensor changed speed: 67
INFO:motor.4:Setting speed to 2
INFO:train.5:Speed sensor changed speed: 109
INFO:train.5:Speed sensor changed speed: 137
INFO:motor.4:Setting speed to 3
INFO:train.5:Speed sensor changed speed: 156
INFO:train.5:Speed sensor changed speed: 169
INFO:motor.4:Setting speed to 4
INFO:train.5:Speed sensor changed speed: 0
INFO:motor.4:Setting speed to 5
INFO:motor.4:Setting speed to 6
INFO:motor.4:Setting speed to 7
INFO:motor.4:Setting speed to 8
INFO:motor.4:Setting speed to 9
INFO:motor.4:Setting speed to 10
INFO:motor.4:Setting speed to 11
INFO:motor.4:Setting speed to 12
INFO:motor.4:Setting speed to 13
INFO:motor.4:Setting speed to 14
INFO:motor.4:Setting speed to 15
INFO:motor.4:Setting speed to 16
INFO:motor.4:Setting speed to 17
INFO:motor.4:Setting speed to 18
INFO:motor.4:Setting speed to 20
INFO:motor.4:Setting speed to 20
INFO:train.5:Set speed to 1
INFO:motor.4:Setting speed to 20
INFO:motor.4:Setting speed to 20
INFO:motor.4:Setting speed to 21
INFO:motor.4:Setting speed to 22
INFO:motor.4:Setting speed to 23
INFO:motor.4:Setting speed to 23
INFO:motor.4:Setting speed to 24
INFO:motor.4:Setting speed to 25
INFO:motor.4:Setting speed to 26
INFO:motor.4:Setting speed to 26
INFO:motor.4:Setting speed to 27
INFO:motor.4:Setting speed to 28
INFO:motor.4:Setting speed to 29
INFO:motor.4:Setting speed to 29
INFO:motor.4:Setting speed to 30
INFO:motor.4:Setting speed to 31
INFO:motor.4:Setting speed to 32
INFO:motor.4:Setting speed to 32
INFO:motor.4:Setting speed to 33
INFO:motor.4:Setting speed to 35
INFO:motor.4:Setting speed to 35
INFO:train.5:Set speed to 2
INFO:motor.4:Setting speed to 35
INFO:motor.4:Setting speed to 35
INFO:motor.4:Setting speed to 36
INFO:motor.4:Setting speed to 37
INFO:motor.4:Setting speed to 38
INFO:motor.4:Setting speed to 38
INFO:motor.4:Setting speed to 39
INFO:motor.4:Setting speed to 40
INFO:motor.4:Setting speed to 41
INFO:motor.4:Setting speed to 41
INFO:motor.4:Setting speed to 42
INFO:motor.4:Setting speed to 43
INFO:motor.4:Setting speed to 44
INFO:motor.4:Setting speed to 44
INFO:motor.4:Setting speed to 45
INFO:motor.4:Setting speed to 46
INFO:motor.4:Setting speed to 47
INFO:motor.4:Setting speed to 47
INFO:motor.4:Setting speed to 48
INFO:motor.4:Setting speed to 50
INFO:motor.4:Setting speed to 50
INFO:train.5:Set speed to 3
INFO:motor.4:Setting speed to 50
INFO:motor.4:Setting speed to 50
INFO:motor.4:Setting speed to 51
INFO:motor.4:Setting speed to 52
INFO:motor.4:Setting speed to 53
INFO:motor.4:Setting speed to 53
INFO:motor.4:Setting speed to 54
INFO:motor.4:Setting speed to 55
INFO:motor.4:Setting speed to 56
INFO:motor.4:Setting speed to 56
INFO:motor.4:Setting speed to 57
INFO:motor.4:Setting speed to 58
INFO:motor.4:Setting speed to 59
INFO:motor.4:Setting speed to 59
INFO:motor.4:Setting speed to 60
INFO:motor.4:Setting speed to 61
INFO:motor.4:Setting speed to 62
INFO:motor.4:Setting speed to 62
INFO:motor.4:Setting speed to 63
INFO:motor.4:Setting speed to 65
INFO:motor.4:Setting speed to 65
INFO:train.5:Set speed to 4
INFO:motor.4:Setting speed to 65
INFO:motor.4:Setting speed to 65
INFO:motor.4:Setting speed to 66
INFO:motor.4:Setting speed to 67
INFO:motor.4:Setting speed to 68
INFO:motor.4:Setting speed to 68
INFO:motor.4:Setting speed to 69
INFO:motor.4:Setting speed to 70
INFO:motor.4:Setting speed to 71
INFO:motor.4:Setting speed to 71
INFO:motor.4:Setting speed to 72
INFO:motor.4:Setting speed to 73
INFO:motor.4:Setting speed to 74
INFO:motor.4:Setting speed to 74
INFO:motor.4:Setting speed to 75
INFO:motor.4:Setting speed to 76
INFO:motor.4:Setting speed to 77
INFO:motor.4:Setting speed to 77
INFO:motor.4:Setting speed to 78
INFO:motor.4:Setting speed to 80
INFO:motor.4:Setting speed to 80
INFO:train.5:Done
INFO:BLE Event Q.0:Hubs end
INFO:train.5:Terminating peripheral
INFO:BLE Event Q.0:Terminating and disconnecxting
quitting
INFO:root:quitting
quit
DavidPowell commented 4 years ago

Thanks @gnbl, by following these instructions I was finally able to get an example running on Windows 10.