From 9ff573e9fe4c40ffb342ce2b215042c39b518aeb Mon Sep 17 00:00:00 2001 From: daniel-Jones Date: Fri, 7 Apr 2017 09:17:10 +0930 Subject: Merged source into one .cpp and .h. Added serial communication from the Arduino to the host computer. Added ping/pong system to maintain a connection, once 3 failed tries have occured, the connection is force closed, this restores the ui to a desired state. A ping is sent every 60 seconds and a response is required within one second. Some debug UI additions and code is still present, to be removed. --- arduino/rgb/.rgb.ino.swo | Bin 20480 -> 0 bytes arduino/rgb/rgb.ino | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 arduino/rgb/.rgb.ino.swo (limited to 'arduino') diff --git a/arduino/rgb/.rgb.ino.swo b/arduino/rgb/.rgb.ino.swo deleted file mode 100644 index 2ab1ac4..0000000 Binary files a/arduino/rgb/.rgb.ino.swo and /dev/null differ diff --git a/arduino/rgb/rgb.ino b/arduino/rgb/rgb.ino index 195eff2..aa35aa0 100644 --- a/arduino/rgb/rgb.ino +++ b/arduino/rgb/rgb.ino @@ -104,7 +104,6 @@ void parse(String com) { String p1; String p2; - p1 = com.substring(0, com.indexOf("=")); p2 = com.substring(com.indexOf("=") + 1); @@ -176,6 +175,8 @@ void parse(String com) bf = p2.toInt(); if (p1.equalsIgnoreCase("bt")) bt = p2.toInt(); + if (p1.equalsIgnoreCase("ping")) + Serial.write("ping=pong\n"); } String line; @@ -202,6 +203,5 @@ void loop() { line += c; } - } } -- cgit v1.2.3