That arduino-code really works? I mean, are you seeing values with digits when you open the serial-monitor?
Usually you should use "Serial.print()" instead of "Serial.write()", when sending float-values.
I prefer to send one line with values from arduino, seperated by spaces:
- Serial.print(h);
Serial.print(" ");
Serial.println(t);
Then in processing using the serialEvent-function to recieve and parse the data:
- void serialEvent(Serial p) {
// get message till line break (ASCII > 13)
String message = p.readStringUntil(13);
if (message != null) {
// try catch function because of possible garbage in received data
try {
String[] elements = splitTokens(message);
RH = float(elements[0]);
tempC = float(elements[1]);
println("tempC: "+tempC);
println("RH: "+RH);
}
catch (Exception e) {
}
}
}
You should remove the while-loop from your sketch then.
And delete the "delay(1000);" from draw(), it should not be needed.