Arduino - SoftwareSerial

Arduino

Reference Language | Libraries | Comparison | Changes

## SoftwareSerial Library

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

     SoftwareSerialExample

#### Functions

- SoftwareSerial()
- begin()
- read()
- print()
- println()

Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.

Share|
©Arduino | Edit Page | Page History | Printable View | All Recent Site Changes