I am trying to adapt this code that I use to read data off the hardware serial to work with the software serial. Here is my code. I get garbage with I read pins 2 & 3 using software serial, but it reads correctly when I use the hardware serial on 0 & 1. Thanks.
#include <SoftwareSerial.h>
#define rxPin 2
#define txPin 3
SoftwareSerial softSerial = SoftwareSerial(rxPin, txPin);
void setup() {
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
softSerial.begin(9600);
Serial.begin(9600);
}
void loop() {
int data = softSerial.read();
if (data != -1) {
softSerial.print(data, BYTE);
}
delay(10);
}