What would be needed to adapt Legoino from ESP32 BLE to micro:bit BLE?

Legoino is a nice library to control LEGO with the Arduino IDE, but it has one big downside: it is written for the Bluetooth module of the ESP32. And compiling for that platform is slow as molasses, simple projects have compile times close to 3 minutes.
Compiling for the micro:bit on the other hand is lightning fast, under 2 seconds to upload for simple scripts. And the microbit has BLE as well. We happen to have quite some micro:bits so that would save expenses on ESP's as well.
Can somebody here see if it is complex to adapt the Legoino library to work on the micro:bit?

Thanks for helping me getting this to work in our classrooms.

You cannot compare apples and pears. There is an Arduino IDE core for the micro:bit. Did you try to compile the same sketches for the ESP32 and the micro:bit on the Arduino IDE? I doubt that you get a 2 second compile time using the Arduino IDE. My guess is you get that 2 seconds only if you transfer scripts rather than compiled code.

BTW you get ESP32s for a few bucks so the cost of the hardware cannot be the limiting factor.

To answer your question: Without having completely analyzed the legoino source code I guess probably the biggest part in porting it to the micro:bit core of the Arduino IDE is porting the NimBLE-Arduino library to the micro:bit.

So if you’re not an experienced BLE programmer on both the ESP32 and the micro:bit I strongly encourage you to simply buy ESP32s for your classes.

Yes, there is indeed fast connection with interpreted scripts instead of compiled code.

There is ongoing work with micropython on the LEGO. I don't know anything about the different Hubs, but it appears that the EV3 work is ahead of the Powered UP.

There are so many differences between the C++ and micropython environments and the support and libraries available. I have no idea if the download time penalty of working in Arduino C++ compiled domain is enough reason to move into the world of micropython interpreted scripts.

I'm really talking compiled code, for example fully working Pac-Man for the micro:bit with a Kitronik Zip-Tile 64. That almost compiles and uploads instantly, way faster than saving a MakeCode HEX or python file to the USB drive, most probably because of the compact file size. Really love how the micro:bit can be run from the Arduino IDE, it delivers IMO the smoothest micro:bit development for kids in Highschool.

I know about Pybricks, we use that as well, but Pybricks is another story. I want to look to get some education funds to have PyBricks rewritten as Arduino library as well, it is STM32 and CC2640R2F chips you will find in those hubs.

I’m really talking compiled code, for example fully working Pac-Man for the micro:bit with a Kitronik Zip-Tile 64.

You compile and upload a fully working Pac-Man C++ code to the micro:bit in 2 seconds? Excuse me but I have serious doubts.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.