Created
May 10, 2019 19:38
-
-
Save enjoycowboy/4e5f5a97546d1059d9ad71131cfa029f to your computer and use it in GitHub Desktop.
live comm usart at
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SoftwareSerial.h> | |
SoftwareSerial mySerial(2, 3); // RX, TX | |
void setup() | |
{ | |
// Open serial communications to computer | |
Serial.begin(9600); | |
mySerial.begin(9600); // Default for the board | |
//Clear out any waiting serial data | |
while (mySerial.available()) | |
{ | |
mySerial.read(); | |
} | |
} | |
void loop(){ | |
/* | |
* This loop just takes whatever comes in from the console and sends it to the board | |
*/ | |
if (Serial.available()) | |
{ | |
mySerial.write(Serial.read()); | |
} | |
if (mySerial.available()) | |
{ | |
Serial.write(mySerial.read()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment