From 353c6d940d6f34a90aca4d9984eec09f51b514d1 Mon Sep 17 00:00:00 2001 From: Jim Martens Date: Wed, 3 Jun 2015 19:07:46 +0200 Subject: [PATCH] [ES] Fixed potential error with loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-óff-by: Jim Martens --- es/blatt3/uebung3-5/uebung3-5.ino | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/es/blatt3/uebung3-5/uebung3-5.ino b/es/blatt3/uebung3-5/uebung3-5.ino index 6eec18a..3a06805 100644 --- a/es/blatt3/uebung3-5/uebung3-5.ino +++ b/es/blatt3/uebung3-5/uebung3-5.ino @@ -90,8 +90,10 @@ void loop() { while (readable) { currentChar = Serial.read(); readable = (currentChar != -1); - command[i] = currentChar; - i++; + if (readable) { + command[i] = currentChar; + i++; + } } command[i] = '\0';