SparkFun Forums 

Where electronics enthusiasts find answers.

#203553
So I've been making a lot of progress with my micro:bit experiments.

What I'm aiming for is to use the micro:bot (and the motor:bit board) to build a robot that can also read various Qwiic sensors over I2C.

I can use MakeCode + Javascript to control the motor:bit and the Qwiic MP3 trigger. This requires writing routines to directly send I2C messages to the Qwiic board.

It would be very helpful to rely on existing libraries for Qwiic peripherals. However, I note that software support for Qwiic peripherals seems to be centered heavily around Arduino. Now, I've been able to get the micro:bit working with the Arduino IDE (and it works well), and even used some of the Sparkfun Qwiic libraries.

So with Arduino, it seems I can use most of the existing Qwiic libraries with the micro:bit - however, I don't have support for the moto:bit motor control! With MakeCode I can control the moto:bit perfectly well, and I can "hand-roll" support for simple I2C interactions.

However, I'd love to have the best of both worlds: to be able to control the moto:bit AND have access to the higher level libraries for I2C devices.

Is there a quick way to port the Arduino libraries for use in MakeCode, perhaps by following something like this: https://learn.sparkfun.com/tutorials/ho ... r-microbit

Alternatively, is there support for the moto:bit in the Arduino environment?

It feels like things are very, very close!
#203833
Hi again gpvillamil,

As far as I know, there is not a quick way or tool to convert Arduino libraries for use with MakeCode. The best option that I know if is to follow the tutorial you linked in your post and manually create MakeCode extensions for the parts you want to use with the micro:bit.

There is technically an Arduino board definition for the micro:bit that Sandeep Mistry has written. You can download and install them following the instructions on his GitHub Repository. Also, it looks like Adafruit has an extensive tutorial on adding this as well but we have not tested it so it is something you would need to use at your own risk. It still is a pretty manual process, though, since the micro:bit will have some quirks you will need to work around in your code in the Arduino IDE.

At the moment, it looks like you may be stuck at a sort of crossroads with your project where you can either try and work on porting MakeCode packages to Arduino or vice versa since there is not a tool that I could find that is built for quickly converting between the two development environments. I hope this helps you decide on which direction you want to go with this.