I'm not able to get a propper connection to my LEGO train hub. As I run the simple example code
from curio import sleep
from bricknil import attach, start
from bricknil.hub import PoweredUpHub
from bricknil.sensor import TrainMotor
from bricknil.process import Process
import logging
@attach(TrainMotor, name='motor')
class Train(PoweredUpHub):
async def run(self):
self.message_info("Running")
for i in range(2):
self.message_info('Increasing speed')
await self.motor.ramp_speed(80,5000)
await sleep(6)
self.message_info('Coming to a stop')
await self.motor.ramp_speed(0,1000)
await sleep(2)
async def system():
train = Train('My train')
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
start(system)
the LEGO device seems to be found and connected (continous LED) but the code stucks and nothing happens. Still if I stop with Strg+C the LEd is on. Please see the log:
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:checking manufacturer ID for device named HUB NO.4 for HUB NO.4
INFO:BLE Event Q.0:found device HUB NO.4
This is the "freeze" state. I'm working on a Raspi 4B with the latest 2020-08-20-raspios-buster-armhf-full.img. At the beginnig I had some warnings with the service_identity module but I fixed and installed the missing modue,
:0: UserWarning: You do not have a working installation of the service_identity module: 'No module named 'service_identity''. Please install it from <https://pypi.python.org/pypi/service_identity> and make sure all of its dependencies are satisfied. Without the service_identity module, Twisted can perform only rudimentary TLS client hostname verification. Many valid certificate/hostname mappings may be rejected.
Does anybody knows a solution or could share her/his experiences with controling the PoweredUp trains with the Raspberry 4?
I'm not able to get a propper connection to my LEGO train hub. As I run the simple example code
the LEGO device seems to be found and connected (continous LED) but the code stucks and nothing happens. Still if I stop with Strg+C the LEd is on. Please see the log:
This is the "freeze" state. I'm working on a Raspi 4B with the latest 2020-08-20-raspios-buster-armhf-full.img. At the beginnig I had some warnings with the service_identity module but I fixed and installed the missing modue,
:0: UserWarning: You do not have a working installation of the service_identity module: 'No module named 'service_identity''. Please install it from <https://pypi.python.org/pypi/service_identity> and make sure all of its dependencies are satisfied. Without the service_identity module, Twisted can perform only rudimentary TLS client hostname verification. Many valid certificate/hostname mappings may be rejected.
Does anybody knows a solution or could share her/his experiences with controling the PoweredUp trains with the Raspberry 4?
Best regards Matthias