
SoftSerial Shield is connected to the Software UART:D2&D3
*/
#
<SoftwareSerial.h>
SoftwareSerial
(2, 3);
buffer[64]; // buffer array for data receive over serial port
count = 0; // counter for buffer array
()
{
SoftSerial.begin(9600); // the SoftSerial baud rate
Serial.begin(9600); // the Serial port of Arduino baud rate.
}
()
{
// if date is coming from software serial port ==> data is coming from SoftSerial shield
(SoftSerial.available())
{
(SoftSerial.available()) // reading data into char array
{
buffer[count++] = SoftSerial.read(); // writing data into array
(count == 64)
;
}
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
}
(Serial.available()) // if data is available on hardware serial port ==> data is coming from PC
or notebook
SoftSerial.write(Serial.read()); // write it to the SoftSerial shield
}
() // function to clear buffer array
{
// clear all index of array with command NULL
(
i=0; i<count; i++)
{
buffer[i]=NULL;
}
}
Step 2. Open the Serial Monitor, the card information can be displayed as
shown below: