-
Hi, first of all I have to thank once more for the Pybricks website. I have created LEGO model of large hydraulic vibration test rig shown in the photo below. You can also watch three short videos displaying the model and its functionality here ... https://www.youtube.com/@seecheck-d5q Motors in the model are controlled by code created using Pybricks. Currently I have one code for vertical cylinders, the other for horizontal ones. They are completely separate. Both are attached. When I want to start the model's operation, I first turn on both HUBs and then press the buttons on them simultaneously to start the program. Is there any way, please, to start the model's operation remotely using LEGO remote control or Xbox controller? Some time ago I managed to create a working code for controlling of LEGO Liebherr crane with Xbox controller. In the case of this new model I don't know what commands should be added so that the model starts working only after pressing a button on the remote control. I am sorry, I'm better at solving mechanical problems than programming. :-) Thanks in advance for any advice. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
First hub: data = hub.ble.observe(1)
while data is None:
pass # Waiting until ready... Second hub: while not Button.A in controller.buttons.pressed():
pass # Waiting till Button A is pressed
hub.ble.broadcast("rdy") # Ready signal See https://pybricks.com/projects/tutorials/wireless/hub-to-hub/broadcast/ Something like this? (I didn't test it) |
Beta Was this translation helpful? Give feedback.
-
Help yourself and you will be helped. :-) New version of the code works as it was asked. |
Beta Was this translation helpful? Give feedback.
Help yourself and you will be helped. :-) New version of the code works as it was asked.
https://www.youtube.com/watch?v=FE8mfzQByqw
MAST_14.zip