control a pybricks technic hub with a android studio smartphone app #1959
Replies: 2 comments 2 replies
-
If you are developing the app, yes, you can use https://developer.android.com/develop/connectivity/bluetooth/ble/ble-overview To get an idea you can look at this tutorial https://pybricks.com/projects/tutorials/wireless/hub-to-device/pc-communication/ and replace the python code on the PC with the android code. This connection based approach is superior to the broadcast based hub-to-hub communication in every aspect, except that the technic hub is only capable of maintaining one connection at a time and a smartphone about 5. Making and maintaining an app that works reliably for multiple devices and multiple android versions using the Android API can be tedious. If you want something easy and portable, web-bluetooth might be an alternative. For web-bluetooth you can look at https://github.com/orgs/pybricks/discussions/1676 and https://github.com/orgs/pybricks/discussions/1942 for inspiration. |
Beta Was this translation helpful? Give feedback.
-
Hi, sorry for two other questions: Try it with python on pc with this (REPL / UART terminal). Changed UUIDs to this for a technic hub. UART_SERVICE_UUID = "c5f50001-8280-46da-89f4-6d8051e4aeef" Have to make it counting 1,3,2 instead of 1,2,3 in the uuid, otherwise the program stops. with 1,2,3 the programm said it sends a for example motor.run(500) i typed in, but nothing happend. Do ist in the terminal of pybricks direct it works. What ar my mistakes? 2.: doing the above to tried to controll a rover with a smartphones camera looking from above knows the rover with opencv and controll it. So with ble the commands comes from the smartphone to the technic hub rover. Maybe the uart terminal is not the best way for that? when instead using the normal pc to hub way: How can i a get things back from the hub like the heading? Sending things like fwd runs for me. Thanks!! |
Beta Was this translation helpful? Give feedback.
-
Hi, is this possible? Can i send commands from a smartphone app to a pybricks program on my hub? Only found text in the documentation to control over keyboard und hub to hub communication. Thank, Mathias
Beta Was this translation helpful? Give feedback.
All reactions