Which Programming Languages Can You Use With Arduino?
Ready to try something different with your Arduino? You needn’t be confined by programming in C when you can take these alternative Arduino languages for a test drive.
The Arduino IDE is core to the ethos behind the project — it’s a UI that attempts to turn the daunting task of learning a programming language into something that anyone can take a stab at. That’s certainly a noble cause, but there might well come a time when the IDE acts as a limit on your creativity.
The important thing is to find a language that speaks to you and the goals that you’re looking to achieve.
Arduino is built around a straightforward programming language that’s meant to be welcoming to newcomers — but if you’re really short on experience, it might be worth trying a tool like XOD. Rather than typing out your code, you’ll be able to construct your program visually using the same selection of functions as you would normally. For a quick look at the software, we’ve created a video that steps you through a small robotics project.
Just because you don’t have to type a line of code, don’t think that this is ‘Arduino for Kids’. Some people just have a brain that works better with visual stimuli. In terms of UI it has a pretty pleasing interface, but aside from the looks, it does present a very logical way of writing code for visual learners. At the same time, you’re still becoming familiar with the function names and variables that you’ll need to use if you decide to move on to the full Arduino IDE.
XOD is a downloadable tool that runs as an overlay to the official Arduino IDE. There’s also a quick-start browser version available as well. The final product won’t be any different from a program built using the normal process, so it’s a great first step if you’re just getting started. For anyone who’s not quite ready to learn a programming language outright, this is an excellent way to learn key concepts without getting caught up in the technicalities of coding.
Based on the drag-and-drop visual programming language developed at Berkeley, Snap4Arduino offers a slightly different experience to that of XOD. The method of building your sketches remains much the same in a visual designer, but it’s clear that this software is intended for a slightly older audience.
With a more understated UI and less of a focus on bells and whistles, Snap4Arduino is resolutely non-patronizing. There’s no sense that this is an easier method of programming; it’s just different from the norm.
One trick to installing Snap4Arduino is the fact that it requires StandardFirmata to be installed on your Arduino. If you already have the Arduino IDE installed on your computer, that’s easy to sort out. Simply open it up and navigate to Examples > Firmata > StandardFirmata. Upload that to your board, and you’ll be able to interact with it from inside Snap4Arduino. Note that you can’t compile programs made in Snap with Firmata, merely interact with the Arduino while it’s connected to your computer.
Serial communications allow for a handy, flexible way for your Arduino to communicate with your computer — you’ll likely have dabbled with the functionality in your early experiments with the device. With the help of a library like CmdMessenger library, you’ll be able to go beyond using serial to merely inspect your Arduino sketch, and begin using it to code in a completely different language.
You can run CmdMessenger in either Microsoft’s Visual Studio or an equivalent third-party alternative. From there, you can communicate back and forth between your PC and the Arduino using C#, so you’re able to do things like call functions and send and receive commands.
Another way to program with C# is to use a purpose-built offshoot of the Arduino device, like the Meadow F7v2 Dev Module by Wilderness Labs. Since it’s built upon the .NET Standard, the Meadow runs C# natively, straight out of the box. While similar to an Arduino, Meadow is a completely different microcontroller and as such, it isn’t an option if you’re looking to program with C# on an Arduino you already own.
While your Arduino can’t run code written in Python out of the box, it is possible to use Python to communicate with the device via serial input. This is very simple on a Unix-like system, but if you’re using a PC or a Mac then pySerial can bridge the gap. You can download pySerial from its developer’s website, which also features a host of information about running the software on various different operating systems — make sure that you have a copy of Python on your system, too.
You can find more information on reading and writing data to Arduino via pySerial through the Arduino documentation page, but be warned that this is a fairly advanced technique. If you’re already well-versed in Python, then you’ll likely have a good handle on how to get it up and running — but if you’re relatively new to either the language or Arduino, there are plenty of great Arduino projects for beginners that you can get started with first.
That being said, Python is a very good fit for use in conjunction with Arduino. It’s a coding language designed to be intuitive, and as such is often recommended as a stepping stone to other forms of coding. What’s more, if you ever happen to branch out from Arduino to the similar Raspberry Pi, you’ll find that your Python experience will come in very handy.
Try a Different Arduino Programming Language Today
If for some reason the Arduino IDE doesn’t work for you, there are a lot of alternative programming languages to choose from. If you already have experience coding, then you might even be able to continue working in your favorite language.
The flexibility to choose a different language means that you can work with one that feels the most intuitive or logical to you. Whether that’s Python, C#, or a visual coding language like Snap4Arduino, there’s likely an option for you.
Building an Arduino traffic light controller helps you develop basic coding skills! We get you started.
About The Author