// Differance between serial write and serial print
// By NMD Weerasinghe COTMD
#include <SoftwareSerial.h>
#define softSerlRx 2
#define softSerlTx 3
#define serPrntDelay 10 // delay between serial prints
SoftwareSerial softSerialPort(softSerlRx, softSerlTx);
String SftSerIncomString ="";
int SftSerIncomNumber = 0;
void ReadSoftserial();
void setup() {
Serial.begin(9600);
Serial.print(35);
delay(serPrntDelay);
Serial.println();
delay(serPrntDelay);
Serial.print("35");
delay(serPrntDelay);
Serial.println();
delay(serPrntDelay);
Serial.write(35);
delay(serPrntDelay);
Serial.println();
delay(serPrntDelay);
Serial.write("35");
delay(serPrntDelay);
Serial.println();
/*
softSerialPort.begin(9600);
delay(100);
//softSerialPort.readString(); // to clear buffer
Serial.print(47);
Serial.write(35);
//delay(serPrntDelay);
//ReadSoftserial();
*/
}
void loop() {
// put your main code here, to run repeatedly:
}
/*
void ReadSoftserial()
{
Serial.println();
int incomeStrinSize = softSerialPort.available();
if(incomeStrinSize < 2) // only one byte received (without Line feed, CR)
{
SftSerIncomNumber = Serial.read();
Serial.print("Number Received from Software Serial : ");
Serial.println(SftSerIncomNumber);
//softSerialPort.write(SftSerIncomNumber);
}
else
{
for(int i = 0; i < incomeStrinSize; i++)
{
SftSerIncomString += Serial.read();
Serial.println(SftSerIncomString);
}
Serial.print("String Received from Software Serial : ");
Serial.println(SftSerIncomString);
//softSerialPort.write(SftSerIncomString);
SftSerIncomString ="";
}
}
*/