diff --git a/PulseSensorAmpd_Processing_1dot1/serialEvent.pde b/PulseSensorAmpd_Processing_1dot1/serialEvent.pde old mode 100755 new mode 100644 index 07e2910..83c11fc --- a/PulseSensorAmpd_Processing_1dot1/serialEvent.pde +++ b/PulseSensorAmpd_Processing_1dot1/serialEvent.pde @@ -4,8 +4,13 @@ void serialEvent(Serial port){ String inData = port.readStringUntil('\n'); + if (inData == null) { // bail if we didn't get anything + return; + } inData = trim(inData); // cut off white space (carriage return) - + if (inData.isEmpty()) { // bail if we got an empty line + return; + } if (inData.charAt(0) == 'S'){ // leading 'S' for sensor data inData = inData.substring(1); // cut off the leading 'S' Sensor = int(inData); // convert the string to usable int @@ -20,4 +25,4 @@ void serialEvent(Serial port){ inData = inData.substring(1); // cut off the leading 'Q' IBI = int(inData); // convert the string to usable int } -} +}