Is it possible to disconnect a Remote #1445
Replies: 5 comments 4 replies
-
If you just want to stop a program, you could call: raise SystemExit This will also disconnect the remote. There isn't currently a dedicated method to close the connection and keep the program running and start accepting another connection. However, with recent Bluetooth improvements this should be a reasonable possibility for implementing if there is a compelling use case for it. What is your use case? |
Beta Was this translation helpful? Give feedback.
-
Well fair enough, the hubs arent ever gonna move away from each other, so I wouldnt need it in this case, although it still seems easier to me if i could switch hubs. I also have a transporter, ideally I would like to turn both vehicles on once, and then be able to switch between them, using the same remote. In this case I might drive one far enough away from the other, so that hub to hub wouldnt be realiable any more, however i have not tested the effective range. I guess i could just put a hub on the remote, and then always use hub to hub, but i would like to avoid that just because the hub is heavy. |
Beta Was this translation helpful? Give feedback.
-
Unfortunately I cannot test this at the moment, but if I think it might be possible using LWP3 device write commands (https://lego.github.io/lego-ble-wireless-protocol-docs/#action-types) like this from pybricks.pupdevices import Remote
from pybricks.tools import wait
my_remote = Remote()
wait(1000)
# my_remote.write(bytes([0x04, 0x00, 0x02, 0x01])) # shutdown
my_remote.write(bytes([0x04, 0x00, 0x02, 0x02])) # disconnect
wait(1000) and possibly catching subsequent errors. |
Beta Was this translation helpful? Give feedback.
-
See also #802. I guess we should just add this feature 😄 |
Beta Was this translation helpful? Give feedback.
-
You can create a mode switch using button combination for example, then the top hub should be only connected to a remote (it can be xbox as well) and broadcast the required controls to the bottom hub. It is simple and works |
Beta Was this translation helpful? Give feedback.
-
Using a Remote Control I would like to be able to disconnect it, so another hub can connect, without having to shutdown the first hub.
Or is it possible to restart a hub?
Beta Was this translation helpful? Give feedback.
All reactions