-
I am building an excavator controlled by an Xbox Controller with two hubs. One in the chassis, the other in the tower. File "Tower.py", line 13, in Have no idea what am i doing wrong....
here is the tower code (receiving hub):
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
If the broadcaster has not started yet or has stopped for too long, this will return data = hub.ble.observe(1)
if data is None:
# handle loss of data
...
else:
section1, section2, section3 = data
# we have good data
... See example: https://docs.pybricks.com/en/stable/hubs/primehub.html#observing-data-from-other-hubs |
Beta Was this translation helpful? Give feedback.
-
Is it possible that the problem is in the hub hardware? Moreover, other programs are loaded via Bluetooth into them and work properly |
Beta Was this translation helpful? Give feedback.
oh, i feel so dumb right now.
well, the code was outputting "none" and going into an infinite loop where new data was not being read. i should have just used the "if" condition, not the "while" loop for checking is there new data. like in the code below.
now the data is being sent and received. the led is green. as expected. all that's left is to handle stopping the motors.
thanks a lot!!