We show here how to integrate Arduino and Processing:
From Arduino to Processing (digital) [Arduino, Processing]
From Arduino to Processing (analog) [Arduino, Processing]
From Processing to Arduino (digital) [Arduino, Processing]
From Processing to Arduino (analog) [Arduino, Processing]
In this part we will integrate Arduino and Processing in order to visualize data coming in real-time from the real world.
Communication protocol. The communication protocol between Arduino and Processing on the serial port is described as follows. Arduino tries the first contact with Processing by sending a byte on the serial port (first contact). When Processing receives the first contact responds by sending a byte on the serial port (ready). Arduino then receives the response and sends the values of the photoresistor, potentiometer and the status of the button (send values). Processing receives (and uses) these values and prompts other values by sending a byte on the serial port (more values). Now Arduino sends other values and Processing requests other data and so on.
Firmware. Arduino code that sounds a piezo (piezoelectric transducer) using a photoresistor (which determines the frequency of the tone) and a potentiometer (which determines the duration of the tone).
Software A: Draw with light. Processing code that draws a radar using a photoresistor (which determines the radar beam) and a potentiometer (which determines the color hue in HSB mode). Use a button to reverse the direction of the radar (clockwise or counterclockwise).
Software B: Move with light. Processing code that draws a complex system. Speed of actors is influenced by light, color of background is determined by potentiometer. Press the button to show the linking network only. Music by Rökkurró.