RFID reader serial communication to arduino

I have a RFID reader with serial port for connection to PC.

I am trying to get it to interface with the arduino uno through a MAX3232.

I have connected pin2 on the DB nine - through the MAX3232 - to digital 3 on the uno.

I get no response from the uno when I scan a tag.

Any help would be appreciated

NB the string manipulation is an aside really it works through the uno and serial monitor and correctly processes the string which is sent by the reader

This is my code…

#include <string.h>

#include <SoftwareSerial.h>

String inputString = “”;// a string to hold incoming data

String previousString = “”;

String outputString = “”;

String rightString = “”;

String leftString = “”;

boolean stringComplete = false;// whether the string is complete

const int led = 13;

const int rxpin1 = 3;

const int txpin1 = 2;

const int rxpin2 = 4;

const int txpin2 = 5;

SoftwareSerial reader(rxpin1, txpin1);

void setup() {

// initialize serial:

Serial.begin(9600);

reader.begin(9600);

digitalWrite(led, LOW);

// reserve 32 bytes for the inputString:

inputString.reserve(32);

//pinMode(led, OUTPUT);

pinMode(rxpin1, INPUT);

}

void loop() {

// clears the string afer processing:

if (stringComplete) {

digitalWrite(led, LOW);

if (inputString != previousString) {

leftString = inputString.substring(4,6) + “-” + inputString.substring(2,4) + “-” + inputString.substring(0,2);

rightString = inputString.substring(18,30);//20? for ear tag reader

outputString = (leftString + " … UK" + rightString +‘\n’);

previousString = inputString;

Serial.print(outputString);

}

// clear the string:

inputString = “”;

stringComplete = false;

}

}

/*

SerialEvent occurs whenever a new data comes in the

hardware serial RX. This routine is run between each

time loop() runs, so using delay inside loop can delay

response. Multiple bytes of data may be available.

*/

void serialEvent() {

if (reader.available()) {

// get the new byte:

digitalWrite(led, LOW);

char inChar = (char) reader.read();

// add it to the inputString:

inputString += inChar;

// if the incoming character is a newline, set a flag

// so the main loop can do something about it:

if ((inChar == ‘\r’) or (inChar == ‘\n’) ) { //or (inputString.length() == 15)

stringComplete = true;

}

}

}

An update here, I have sorted my first problem, in that I thought that R1in and T1out stood for RS232 in and TTL Out, and that a signal on R1in went to T1out. Oh No, the T is Tx and The R is Rx. It’s all beginning to work. :wink: