From ba628fc65bb72580cafa326d00c231f28032cf47 Mon Sep 17 00:00:00 2001 From: "J. Elfring (p)" Date: Mon, 2 Sep 2019 12:22:25 +0200 Subject: [PATCH] Simpler serial read With chars instead of strings. --- led-annunciator/led-annunciator.ino | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/led-annunciator/led-annunciator.ino b/led-annunciator/led-annunciator.ino index 89e8f2b..d454586 100644 --- a/led-annunciator/led-annunciator.ino +++ b/led-annunciator/led-annunciator.ino @@ -41,14 +41,15 @@ void setup() { void loop() { // SERIAL - while (Serial.available()) { - String rcv_sr = Serial.readString(); + while ( Serial.available() > 0 ) { + int rcv_sr = Serial.read(); // Send data to serial port - Serial.println("RX serial: " + rcv_sr); + Serial.print("RX serial: "); + Serial.println(rcv_sr, DEC); // Switch LEDs - switch (rcv_sr[0]) { + switch (rcv_sr) { case 'g' : led_allOff(); led_greenLine();