Skip to content

Instantly share code, notes, and snippets.

@smetronic
Created December 14, 2017 12:11
Show Gist options
  • Save smetronic/bd43195d2303bb5f5b051016dfb2f20d to your computer and use it in GitHub Desktop.
Save smetronic/bd43195d2303bb5f5b051016dfb2f20d to your computer and use it in GitHub Desktop.
ATMega 328p: Serial Communication
#include <SoftwareSerial.h>
SoftwareSerial mySerial(13, 12); // RX, TX
void setup() {
Serial.begin(38400); //Baud Rate
mySerial.begin(38400);
}
void loop() {
if (mySerial.available()) { //Check if serial is available or not
Serial.println(mySerial.read());
}
if (Serial.available()) {
mySerial.println(Serial.read());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment