Well, I am new to this stuff… It took me days to just get a serial connection going. For you other newbies, if you are looking to just start off with a simple serial connection to your Uno, use this code.
The intended connection points on a Uno board is using Analog 4 & 5 (A4 & A5), otherwise known as Digital 18 & 19 (D18 & D19). Feel free to change these up, but try not to use D0 & D1 as those pins also share how the Uno is programed via USB.
/**
* Here is your code needed to make the RN-XV work with an Uno.
* Take this code and use it to make your own sketches.
* I am using Arduino IDE 1.0.5
*/
#include <SoftwareSerial.h>
SoftwareSerial mySerial(18, 19); // RX, TX
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println("Serial Connection is go!");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
}
void loop() // run over and over
{
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}