What Is the Connection between Processing and Arduino®?
The Arduino® is an open-source augmented micro-controller that is programmed using a language based on Wiring. Its development environment, however, is based on Processing — a free, downloadable programming language that is commonly used for generating computer graphics and complex data visualizations. Sketches, which are also called programs, built in Processing and the Arduino® language use the Processing Development Environment (PDE) file extension. Additionally, Processing and Arduino® sketches can communicate with one another, providing bi-directional control over Processing sketches and Arduino® hardware.
Communication can be unidirectional or bi-directional between the Processing and Arduino® environments. The data from a Processing sketch, for example, can be used to control the hardware connected to the Arduino® micro-controller, or data from the micro-controller can be used to control the functionality of a Processing sketch. Alternatively, both environments can affect one another simultaneously. Some examples of Processing and Arduino® projects include using potentiometers to control the color of an object displayed by a Processing sketch, and using mouse-click events from a Processing sketch to control a series of light-emitting diodes (LEDs).
The Processing and Arduino® languages communicate with one another through code and the universal serial bus (USB) port, which emulates and shows up as the computer's serial port. To set up bi-directional communication between the micro-controller and Processing, or to control Processing with the Arduino®, users write sketches in both languages. The Processing sketch looks for the serial port connected to the Arduino®, while the micro-controller code receives and transmits data from the Arduino's® inputs and outputs. This provides hobbyists with total control over their projects.
The available free Arduino® library for Processing allows users to control an Arduino® with data from Processing without writing any code for the micro-controller. Instead, a standard program is uploaded to the board, and the user writes the code in the Processing sketch. The written code typically performs the following functions: finds and opens the serial port connected to the Arduino®, stores data from the micro-controller in variables, and uses the data to control different parameters, such as an object's size or color, in the Processing sketch.
People who are learning to work with the Arduino® and Processing can find example sketches in the Arduino® programming environment. These sketches come with every download of the application, and users can typically run them without writing any additional code. The makers of the Arduino® also provide fully commented Processing and Arduino® code online.
Discuss this Article
Post your comments