Integration of Processing and Arduino

Let’s make a simple but fun integration. You can make a more complex integration if you need. I don’t need…

Why this integration is cool? Because is with a external hardware (LDR). We change a program based on a value of a LDR (an resistor that value depends on the light).

Is not a very simple hardware schema. This figure shows the hardware:

Processing is a cool tool that allow you make beatiful programs. You can get it in . There is a download link in the menu in the right.

Arduino you can get in

You will need the Arduino to read the LDR value and Processing to use this value. We load an image and use it as background. And draw a circle based on the mouse position.

The Arduino code is:

Arduino basics: setup() run once and loop run in loop() after setup(). We connected LDR to port analog 5 (A5) of the Arduino and print the value read in the serial.

The Processing code is:

Programador do CAC/COE da Riachuelo

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store