don't overflow serial buffer
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 29 Aug 2015 22:36:41 +0000 (00:36 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 29 Aug 2015 22:36:41 +0000 (00:36 +0200)
rpi_promini/rpi_promini.ino

index 73d3092..81964a3 100644 (file)
@@ -154,7 +154,7 @@ void loop() {
        Serial.println(dht.getStatusString());
      }
 
-     if ( input >= 0x30 && input <= 0x39 ) {
+     if ( input >= 0x30 && input <= 0x39 && serial_pos < 2 ) {
        input = input - 0x30; // ASCII to number
        serial_data[serial_pos++] = input;
      } else {