gpdaniels / spike-prime

Experiments with the LEGO Mindstorms (51515) and SPIKE Prime (45678)
MIT License
282 stars 39 forks source link

Send messages between a hub and a bluetooth application. #8

Open gpdaniels opened 3 years ago

gpdaniels commented 3 years ago

Desktop app:

Android app:

postpersonality commented 3 years ago

Hi! I've investigated this a bit. I have a small dump of a short bluetooth session between Android Robot Inventor and the hub. So far I see it's working via BT, not BLE since it uses RFCOMM. RFCOMM is a part of BT stack.

Here is what I found so far.

Android -> Hub request messages

Description of the request message

Hub -> Android status messages

pizzakid25 commented 3 years ago

I found a few additional commands I thought might be useful:

brabebhin commented 3 years ago

Hi. Does sending these commands work with the factory firmware or do I have to flush something custom?

I have a research project using these 51515 hubs as targets, and I have been looking for a way to control them through a desktop application without the need of LEGO app.

pizzakid25 commented 3 years ago

@brabebhin These commands work with the default firmware over Bluetooth or USB. Most commands should work for both 51515 and Spike hubs, but there might be a few that are system-specific since the firmware varies slightly.

brabebhin commented 3 years ago

Cool thank you for the information. One more question: i know in older lego sets the serial message had to be prefixed with the length of the message, does this apply here as well?

Thanks