From 7fcd7de8c4e6202b1562538280d92fe8c1cee80d Mon Sep 17 00:00:00 2001 From: Mike C Date: Thu, 28 Mar 2013 22:36:44 -0400 Subject: [PATCH] Added serial IO to main loop for testing Cisco serial console work --- .../Universal_Serial_Adapter.ino | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/Universal_Serial_Adapter/Universal_Serial_Adapter.ino b/Universal_Serial_Adapter/Universal_Serial_Adapter.ino index a1a1f21..c13f889 100644 --- a/Universal_Serial_Adapter/Universal_Serial_Adapter.ino +++ b/Universal_Serial_Adapter/Universal_Serial_Adapter.ino @@ -50,22 +50,22 @@ char* modeToText[4] = { // Known and supported line speeds linespeedinfo linespeeds[6] = { { - "2400b", 2400 } + "2400b", 2400 } , { - "9600b", 9600 } + "9600b", 9600 } , { - "19.2k", 19200 } + "19.2k", 19200 } , { - "38.4k", 38400 } + "38.4k", 38400 } , { - "57.5k", 57600 } + "57.5k", 57600 } , { - "115k", 115200 } + "115k", 115200 } }; // LCD @@ -113,9 +113,24 @@ void setup() { // Setup defaults setDefaults(); + + Serial.begin(9600); + Serial1.begin(9600); } void loop() { + // read from port 1, send to port 0: + if (Serial1.available()) { + int inByte = Serial1.read(); + Serial.write(inByte); + } + + // read from port 0, send to port 1: + if (Serial.available()) { + int inByte = Serial.read(); + Serial1.write(inByte); + } + xAxis=map(analogRead(xpin), 0, 1023, 0, 10); yAxis=map(analogRead(ypin), 0, 1023, 0, 10); @@ -155,3 +170,5 @@ void loop() { } } + +