How do I program my mBot with other programming languages like C++


#1

Hi everyone,
I wanted to ask that how can I program my mbot in C++, python JavaScript languages like that.
I know python and a bit of c++ but How can i do that.
I tried controlling the mbot using python3 libraries like pyONArduino and Another library made by @xecos a github user but they werent efficient enough.

Why I want to program it with c++ is because I don’t know c (even the hello world)

Pls tell me a way I can program it using C++
It would be great

:slight_smile:


#2

Hi Saad nice that you want to program in C++. 2 weeks ago I bought my mBot and before that never programmed C++, but it’s pretty easy. You can program your mBot using the Arduino IDE (software). If you download the makeblock library you will also find some example sketches about certain features of the bot. For instance motorcontrol, led blinking, buzzer, sensors etc…

You can do it without the makeblock library but be prepared to for all the pin assignments and other challenges that come with it.

The Python libraries/packages you refer to I also tried and was just like you not very satisfied. I now write my own C++ en Python and it’s way more efficient and understandable if you now what you’re doing.

Take a look at my git if you wanna see some example code and/or tutorials. I try to write as much comments as possible in my code so everyone can understand it.
https://github.com/Atonbom/KimPyRaptor

Also have a look at these links, they really helped me at least…
Arduino and mBot



Serial communication
https://www.arduino.cc/reference/en/language/functions/communication/serial/
https://www.norwegiancreations.com/2017/12/arduino-tutorial-serial-inputs/#:~:text=Using%20serial%20inputs%20is%20not,on%20your%20keyboard%20to%20send
https://forum.arduino.cc/index.php?topic=396450.0

Python