Can Python Be Used With Arduino? Here's Which Programming Languages Are Supported
Arduino is a popular brand of open-source microcontrollers that can be used for a variety of DIY projects, from educational settings to home theater to smart home management. The microcontrollers are simpler than Raspberry Pi's single board computers, and to program them, you will need to use the integrated development environment (IDE) app that's available for Windows, Linux, and macOS. It's even accessible on ChromeOS devices via a web editor. Until recently, Arduino microcontroller users needed to utilize the company's Arduino programming language, which is essentially a subset of the C/C++ languages. Since 2022 however, the company has been increasing its support for the MicroPython programming language — a subset of Python 3.
To program an Arduino controller, you'll need to access the Arduino IDEs on a separate machine if you're using the default Arduino programming language. For MicroPython, the company provides another IDE software. Both the IDEs are open source, and their source code are available on GitHub. Raspberry Pi controllers on the other hand support a variety of programming languages, including C/C++, HTML/CSS, Java, Javascript, jQuery, Perl, and Python, directly on the Debian-based Raspberry Pi OS loaded on the hardware. There are also a number of other operating systems you can run the Raspberry Pi.
If you're looking to get started on your first Arduino project and don't have any programming experience, all this may sound a bit intimidating. But there are plenty of resources to help you, whether it be the forum and help center, complete documentation, or the myriad projects for beginners to get their first hands-on experience.
Arduino supported programming languages
There are three officially supported languages for programming your Arduino microcontroller. First up, is the default Arduino programming language — which is a limited version of the C/C++ languages. To use it, you'll need to download the regular IDE software that's available for a variety of operating systems — namely 64-bit versions of Windows 10 (or newer), Linux, and macOS 10.15 (or newer), at the time of writing. You can also just use the C/C++ languages themselves in the IDE, but with a few caveats. The Arduino IDE is also accessible via web browsers, using the Arduino Web Editor or Cloud Editor on the Arduino Create platform. There are also plenty of libraries users can import to augment the range of functions available.
Next, we've got the MicroPython programming language, for which support was introduced a couple of years ago. The language, based on Python 3, was created by Damien George specifically as a lightweight version meant for microcontrollers – capable of running on 256 kb of code space and 16 kb of RAM. To program an Arduino board using MicroPython, you'll require a separate IDE called the Arduino Lab for MicroPython, and it's available for 64-bit versions of Windows, Linux, and macOS. Only a certain number of Arduino microcontrollers currently have MicroPython support, and you can find all the details you need on the documentation page. There's also a specialized MicroPython-based firmware and IDE called OpenMV for Arduino machine vision and learning applications.
To program the software architecture of the Arduino board's control program, such as Portenta Machine Control and Arduino Opta, you will need to use IEC-61131-3 languages. This can be done via the Arduino PLC IDE, which is available for 64-bit Windows 10 only.