We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm more of a hardware guy and new to Processing and was wondering if someone could write some quick code for what I am trying to achieve so that I may use it as reference. I have an Arduino with 3 analog sensors and would like to display the measured reading on a Processing window. Also, I would like some drawing in Processing react depending on the sensor values. For example, 3 circles that would change color depending on each sensor reading as if they were virtual LEDs. My Arduino code writes the sensor values to the Serial port using this code:
Serial.println(sensor1);
Serial.println(sensor2);
Serial.println(sensor3);
Using the Sketch Serial viewer I can see the sensor values going through the serial port correctly I'm familiar with setting up the Serial communication protocol in Processing such as below:
import processing.serial.*;
Serial myPort;
void setup()
{
size(300, 300);
String portName = Serial.list()[0];
myPort = new Serial(this, portName, 9600);
}
What I'm having trouble finding info on is, how I assign each of the sensor values in Arduino to variables in Processing? I think I've seen an example with one variable being assigned but could not figure out how to get three.
Thanks in advance!
Answers
in arduino ide: example-->communication-->VirtualColorMixer, see the processing sketch for 3 analog sensor, or http://arduino.cc/en/Tutorial/VirtualColorMixer
This is awesome! It appears like it's what exactly I'm trying to do. I"ll give it a shot tonight. Thanks!