I am using pressure sensor with Arduino Uno within Processing. Given these variables:
Serial myPort; //the serial port
float sensorValue = 0; //the value form the sensor
Arduino is printing float numbers on Processing console, according to the snippet below.
(...)
void serialEvent (Serial myPort){
//get the ASCII string
String inString = myPort.readStringUntil('\n');
if (inString != null){
//trim off any whitespace:
inString = trim(inString);
//convert to an int and map to the screen height
sensorValue = float(inString);
println(sensorValue);
sensorValue = map(sensorValue, 0, 1023, 0, height);
//println(sensorValue);
However, I am getting a NaN
exception:
sensorValue = map(NaN, 0, 1023, 0, height);
how is this possible? printing numbers that aren't numbers?