Processing display multiple Arduino sensor reading and change drawing

edited October 2014 in Arduino

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:


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!


Sign In or Register to comment.