Display a temperature on processing with arduino

edited January 2014 in Arduino

Hello, everyone

As part of a research project, I have to display the temperature of two temperature sensors on processing Grove I know posting on the Arduino Terminal but not with Processing. Could you help me please?

my code Arduino :

void setup()
{
  Serial.begin(9600);             
}

void loop()
{
  int value1 = analogRead(0); 
  Serial.println(value1); 
  int value2 = analogRead(1); 
  Serial.println(value2);
  delay(1000);
}

Here are my early processing code that works only for displaying the value of a sensor on both:

Serial myPort;
float value=0;
void setup() {
size(200, 200);
println(Serial.list());
myPort = new Serial(this, Serial.list()[0], 9600);
myPort.bufferUntil('\n');
}

void draw() {
background(0);
fill(255);
  text(nf(value, 0, 1) + "°C", width/2, height/2);
}

void serialEvent(Serial myPort) { 

String inString = new String(myPort.readBytesUntil('\n'));
if (inString != null) {
   inString = trim(inString);
   float col = float(inString);
   value=col*1;
}
}

Comments

Sign In or Register to comment.