Best Programming Language for Arduino

Hello,
Is Python can do what C and C++ for Arduino?
I know how to read some C and few lins took one course before 11 years of VB.NET and didn’t touch any programming thing after that. I want to start but confused.
Can some one guide me where to start?
Thank you.

The Arduino tutorials and documentation that is provided by them is C/C++based.

https://www.arduino.cc/en/Tutorial/HomePage

1 Like

This post was flagged by the community and is temporarily hidden.

Short answer:

No, Python will not be suitable for Arduino programming.
Taking the time to learn the basics of C will be the best way to go here. It can be scary at first, but it is the correct tool for the job.

Note: My knowledge is from 5-6 years ago, things may have changed since then.

Longer answer:

Python can be compiled to C and - at least theoretically - be used in that way for Arduino programming. But you’re likely to have a higher learning curve doing that that and learning Arduino specific stuff and the hardware side all at the same time. Not to mention you’ll have next to zero support from any community. Your build-test loop will also be horribly ugly. Debugging anything would be an exercise in pain tolerance.

At the root, the standard python language won’t work so well, largely because you won’t have access to many of the Arduino libraries that are essential for working with the hardware.

In this case, C and C++ were chosen for the Arduino for a reason. They have mechanisms purposely exposed for reading from and manipulating hardware registers - which is how you interface with the hardware (like the Arduino). C also has very little magic “behind the scenes”. If you type a few lines of code, you can be pretty sure they won’t be optimized to do something slightly different. For example, when you learn about C’s volatile keyword, you’ll see that it’s probably not even possible to emulate that functionality with standard Python. And this will be something you use fairly frequently with Arduino, depending on your projects. You would end up having to write a custom library in C, then build a Python library from it, use it, then compile back to C again.

In short, learn some C and the basics of C++ if you like. Run through some Arduino tutorials. The Arduino IDE runs on a subset of C++ (or a superset of C). You’ll see, it’s not so bad!

2 Likes