Skip to content

Instantly share code, notes, and snippets.

@tejasvi
Created March 16, 2019 06:58
Show Gist options
  • Save tejasvi/a6ea2ae8b50933c4833d37efb742964a to your computer and use it in GitHub Desktop.
Save tejasvi/a6ea2ae8b50933c4833d37efb742964a to your computer and use it in GitHub Desktop.
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(57600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(4800);
mySerial.println("Hello, world?");
}
void loop() { // run over and over
if (mySerial.available()) {
Serial.write(mySerial.read());
}
if (Serial.available()) {
mySerial.write(Serial.read());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment