My first post here.
I have Seeduino 4.3 with base board and two Grove 125 khz RFID readers. The main board is ok connected as Arduino Uno in the IDE. I have followed the basic steps given at Grove - 125KHz RFID Reader | Seeed Studio Wiki using the sketch given there. I have tried 25mm ‘paper’ tags, keyfob tag and card. Nothing triggers the softserial.
All the lights are on. The Seeduino responds e.g. Setup() runs; Loop() iterates; it echoes Serial Monitor input. I have tried using default SoftSerial(2,3) and added another reader as SoftSerial2(5,6) - nothing happens. I started with the sketch as supplied and modified slightly while trying to see if this is a software or hardware problem.
Full code:
/*
link between the computer and the SoftSerial Shield
at 9600 bps 8-N-1
Computer is connected to Hardware UART
SoftSerial Shield is connected to the Software UART:D2&D3
*/
#include <SoftwareSerial.h>
SoftwareSerial SoftSerial1(2,3); // RX/TX = D2 on base shield
SoftwareSerial SoftSerial2(5,6); // RX/TX = D5 on base shield
unsigned char buffer[64]; // buffer array for data receive over serial port
int count = 0; // counter for buffer array
int n = 0;
void setup()
{
SoftSerial1.begin(9600); // the SoftSerial baud rate
SoftSerial2.begin(9600); // the SoftSerial baud rate
Serial.begin(9600); // the Serial port of Arduino baud rate.
Serial.println("hello from seeeduino");
}
void loop()
{
// if data is coming from a software serial port ==> data is coming from SoftSerial shield
if (SoftSerial1.available())
{
Serial.println("data on SoftSerial1");
while(SoftSerial1.available()) // reading data into char array
{
buffer\[count++\] = SoftSerial1.read(); // writing data into array
if(count == 64)break;
}
Serial.write(buffer, count); // if no data transmission ends, write buffer to hardware serial port
clearBufferArray(); // call clearBufferArray function to clear the stored data from the array
count = 0; // set counter of while loop to zero
}
if (SoftSerial2.available())
{
Serial.println("data on SoftSerial2");
while(SoftSerial2.available()) // reading data into char array
{
buffer\[count++\] = SoftSerial2.read(); // writing data into array
if(count == 64)break;
}
Serial.write(buffer, count); // if no data transmission ends, write buffer to hardware serial port
clearBufferArray(); // call clearBufferArray function to clear the stored data from the array
count = 0; // set counter of while loop to zero
}
if (Serial.available()) // if data is available on hardware serial port ==> data is coming from PC or notebook
{
Serial.println("data received on serial port: ");
while(Serial.available()) // reading data into char array
{
buffer\[count++\] = Serial.read(); // writing data into array
if(count == 64)break;
}
//Serial.write(buffer, count); // if no data transmission ends, write buffer to hardware serial port
Serial.write(buffer, count);
Serial.print("\\nchars rcvd: ");
Serial.println(count);
clearBufferArray(); // call clearBufferArray function to clear the stored data from the array
count = 0; // set counter of while loop to zero
//SoftSerial.write(Serial.read()); // write it to the SoftSerial shield
}
n++;
}
void clearBufferArray() // function to clear buffer array
{
// clear all index of array with command NULL
for (int i=0; i<count; i++)
{
buffer\[i\]=NULL;
}
Serial.println("\\ncleared buffer");
}
Any ideas please?