Skip to content

Instantly share code, notes, and snippets.

@enjoycowboy
Created May 10, 2019 19:38
Show Gist options
  • Save enjoycowboy/4e5f5a97546d1059d9ad71131cfa029f to your computer and use it in GitHub Desktop.
Save enjoycowboy/4e5f5a97546d1059d9ad71131cfa029f to your computer and use it in GitHub Desktop.
live comm usart at
#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