Skip to content

Instantly share code, notes, and snippets.

@mash
Created August 22, 2014 05:11
Show Gist options
  • Save mash/f9825dc7a075907da578 to your computer and use it in GitHub Desktop.
Save mash/f9825dc7a075907da578 to your computer and use it in GitHub Desktop.
#include <SoftwareSerial.h>
// Not all pins on the Leonardo support change interrupts,
// so only the following can be used for RX:
// 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).
SoftwareSerial mySerial(14, 15); // 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 Leonardo only
}
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerial.println("Hello, world?");
}
void loop() // run over and over
{
while (mySerial.available()) {
int in = mySerial.read();
// Serial.print(in);
mySerial.write(in);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment