Blynk Serial Communication

What is difference in Arduino serial usb and Arduino softwareserial usb

#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3);
Blynk.begin(Serial, auth); //When I have to go for serial_usb
//The serial library is included here

#include <SoftwareSerial.h>
SoftwareSerial swserial(2, 3);
Blynk.begin(swserial, auth); //When I have to go for softwareserial_usb
//The swserial object is included here
Can you explain me the difference in both the commands

SoftwareSerial library is used when you want to use 2 of the input/output pins for serial communication instead of the normal arduino TX and RX pins of the serial port. On arduinos that don’t have more that 1 serial port, the TX and RX pins are tied to the same serial port as the usb cable that connects to the pc. So if you need an additional serial port you can use SoftwareSerial to make I/O pins act as another serial port.

In your case your telling it to use pin 2 as RX and pin 3 as TX.

“swserial” is essentially just the name your giving your SoftwareSerial port that you can reference later.

1 Like

Thank you for the explanation.
I understood the concept now

You can read more about it here as well.

https://www.arduino.cc/en/Reference/SoftwareSerial