ReferenceLanguage | Libraries | Comparison | Changes
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. The version of SoftwareSerial included in 1.0 and later is based on the NewSoftSerial library by Mikal Hart. To use this library #include SoftwareSerial.h Limitations. The library has the following known limitations: If using multiple software serial ports, only one can receive data at a time. SoftwareSerial is a library that enables serial communication with a digital pin other than the serial port. It is possible to have multiple software serial ports with speeds up to 115200bps. However, be careful when the baud rate is 115200bps because the reception latch timing is not so accurate. The receive buffer is fixed at 256 bytes.
SoftwareSerial Library
EspSoftwareSerial-6.11.0.zip
Softwareserial.h Library Download
The Arduino hardware has built-in support for serial communication on pins 0 and 1 (which also goes to the computer via the USB connection). The native serial support happens via a piece of hardware (built into the chip) called a UART. This hardware allows the Atmega chip to receive serial communication even while working on other tasks, as long as there room in the 64 byte serial buffer.
The SoftwareSerial library has been developed to allow serial communication on other digital pins of the Arduino, using software to replicate the functionality (hence the name 'SoftwareSerial').
Limitations
Because it's not supported by hardware, the library has a few limitations:
- Only speeds up to 9600 baud work
- Serial.available() doesn't work
- Serial.read() will wait until data arrives
- Only data received while Serial.read() is being called will be received. Data received at other times will be lost, since the chip is not 'listening'.
SoftwareSerial appears to have some timing issues and/or software issues. Check this forum thread for discussion.Software Serial Discussion. In particular, if you are having problems using SoftwareSerial with an Atmega168 chip delete SoftwareSerial.o in your Arduino directory.
Example
Functions
- SoftwareSerial()
- begin()
- read()
- print()
- println()
Download Arduino Softwareserial Library
Corrections, suggestions, and new documentation should be posted to the Forum.
Nextion + Arduino Due: SoftwareSerial Issue
The text of the Arduino reference is licensed under aCreative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.