bricklife / LEGO-Hub2Hub-Communication-Hacks

LEGO MINDSTORMS Robot Inventor's Hub to Hub Communication Hacks
14 stars 7 forks source link

How to create a connection with raspberry pi and lego inventor hub? #3

Open xiaoye-cn opened 2 years ago

xiaoye-cn commented 2 years ago

Hi Shinichiro Oba:

Your work is amazing. Thank you!

My work environment: I use Raspberry Pi 4B and PI OS built-in python for Raspberry Pi development I use the Lego Inventor Hub and Scratch for the LEGO MINDSTORMS APP 10.3.1 for programming. My project goal is: I want the Raspberry Pi to communicate with the Lego Inventor Hub via Bluetooth. (Like hub to hub communication in LEGO MINDSTORMS APP)

My question is: The program on the Lego Inventor Hub can be completed in the LEGO MINDSTORMS APP. There is no need to use python programs on the Hub, right?

I am unable to create a Bluetooth connection between the Lego Inventor Hub and the Raspberry Pi. (I use the Blueman program under the pi os, or the built-in Bluetooth program. It can discover the Lego Inventor Hub via Bluetooth, but it disconnects immediately after the connection is established.)

Hope for your help with the above questions.

thank you very much

RobertGuo

mobcom commented 1 year ago

From what I understand it works differently. In BLE, a device can broadcast packets to "advertise" itself or some data it has. Other devices can "scan" for these advertising packets without having to connect to the advertising device. This is useful for many applications where you want to collect or broadcast small amounts of data without maintaining a connection, thus saving power. So there is no direct connection here, also the code does not seem to work anymore, perhaps due to some update (Hub OS 3.2.36) Lego has made.