For the Professional Maker: If You Speak Arduino, Processing Takes Things to the Next Level
November 30, 2018
If you?ve been using Arduino boards?or, more generally programming in the Arduino IDE?you already know the basics of programming in Processing.
Many students and makers have been introduced to the world of programming and hardware through Arduino boards such as the Uno. The programming language is relatively simple for tasks like blinking a light or controlling a servo, and seeing what happens is just a matter of connecting a USB cable, connecting it, making the proper selections, and waiting for it to load... Actually, if you’re brand new to programming, that isn’t always that trivial, and experienced Arduino programmers might admit that they’ve been frustrated when, say an Uno was selected as the board that would run a program instead of the Nano they were actually using.
What if there was a way to do the same type of programming, developing your Arduino-like skills in a cross-platform computer-only environment? Ideally, programs written in this environment could even interact with an Arduino as a portal into the real world. If that sounds interesting, the language you’re looking for is Processing.
While this language would be great for a novice programmer, if you’ve been using Arduino boards—or, more generally programming in the Arduino IDE—you already know the basics of programming in Processing. There are some differences, such as using “void draw()” instead of “void loop()” to designate the main body of the program; however, the overall syntax of the language is largely the same. In fact, according to this article about connecting an Arduino to Processing, the Arduino software is partially based off of this language, which is itself a dialect of Java.
To get started interfacing your Arduino board with Processing, the previous link goes over how to share serial information between the two. Another option is to use the Firmata protocol, which takes care of the communication details over serial using a MIDI message format.
Beyond its uses with Arduino, at its heart, Processing is a very useful tool for quickly designing graphical computer interactions and requires almost no setup. The program and output seen above is based on the book Make: Getting Started with Processing. With just over 20 lines of code, it’s able to produce a program where circles are drawn based on your mouse cursor and can be erased with a click. One would normally expect this type of interaction to take much more “yak shaving” to produce, but Processing lets you dive right in, concentrating more on the output than lower-level programming concepts.
While this kind of graphics-focused programming might seem limiting, it’s also a great way for novice programmers to get started on the journey without worrying about the details that those with more experience take for granted. For those who do have more experience—especially with Arduino boards—it can provide a good way to allow your computer to interact with the real world. Because you already know the syntax if you do program in the Arduino IDE, the cost time-wise of learning the language is very low and learning Processing could help show you a few techniques that you may have missed previously.
Jeremy S. Cook is a freelance tech journalist and engineering consultant with over 10 years of factory automation experience. An avid maker and experimenter, you can see some of his electromechanical exploits on the Jeremy S. Cook YouTube Channel!