diff --git a/examples/Example4-ProcessingHeatCam/HeatCam/HeatCam.pde b/examples/Example4-ProcessingHeatCam/HeatCam/HeatCam.pde index 76b8287..6fba64d 100644 --- a/examples/Example4-ProcessingHeatCam/HeatCam/HeatCam.pde +++ b/examples/Example4-ProcessingHeatCam/HeatCam/HeatCam.pde @@ -72,6 +72,11 @@ void draw() { if(myPort.available() > 64){ myString = myPort.readStringUntil(13); + // readStringUntil is a non-blocking function and will return null if it can't find the linefeed + if(myString == null){ + return; + } + // generate an array of strings that contains each of the comma // separated values String splitString[] = splitTokens(myString, ","); @@ -117,4 +122,4 @@ void draw() { // Add a gaussian blur to the canvas in order to create a rough // visual interpolation between pixels. filter(BLUR,10); -} \ No newline at end of file +}