SoftwareSerial Library - Arduino Documentation
SoftwareSerial Library - Arduino Documentation
C C
Go Back
Home / Learn / SoftwareSerial Library ON THIS PAGE
Learn
SoftwareSerial Library Limitations of This Library
Examples
Programming The SoftwareSerial library allows serial communication on other digital pins of an Arduino
board. Methods
Electronics SoftwareSerial()
Author Arduino Last revision 15/06/2022
Syntax
Communication
Parameters
The SoftwareSerial library allows serial communication on other digital pins of
Hardware Design Returns
an Arduino board, using software to replicate the functionality (hence the name
"SoftwareSerial"). It is possible to have multiple software serial ports with Example
Built-In Libraries speeds up to 115200 bps. A parameter enables inverted signaling for devices See also
which require that protocol. available()
PDM Library
The version of SoftwareSerial included in 1.0 and later is based on the Help
I2S Library
NewSoftSerial library by 'Mikal Hart'.
EEPROM Library
To use this library:
SoftwareSerial Library
COPY
1 #include <SoftwareSerial.h>
Examples
SoftwareSerial example: sometimes one serial port just isn't enough!
Methods
SoftwareSerial()
Syntax
COPY
Parameters
Returns
None.
Example
COPY
See also
available()
begin()
isListening()
overflow()
peek()
read()
print()
println()
listen()
write()
available()
Get the number of bytes (characters) available for reading from a software
serial port. This is data that has already arrived and stored in the serial receive
buffer.
Syntax
COPY
1 mySerial.available()
Parameters
None.
Returns
Example
COPY
See also
SoftwareSerial()
begin()
isListening()
overflow()
peek()
read()
print()
println()
listen()
write()
begin()
Sets the speed (baud rate) for the serial communication. Supported baud rates
are: 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 31250, 38400,
57600, and 115200 bauds.
Syntax
COPY
1 mySerial.begin(speed)
Parameters
speed: the desired baud rate (long). Supported baud rates are: 300, 600,
1200, 2400, 4800, 9600, 14400, 19200, 28800, 31250, 38400, 57600, and
115200 bauds.
Returns
None.
Example
COPY
See also
SoftwareSerial()
available()
isListening()
overflow()
peek()
read()
print()
println()
listen()
write()
isListening()
Syntax
COPY
1 mySerial.isListening()
Parameters
None.
Returns
Boolean.
Example
COPY
See also
SoftwareSerial()
available()
begin()
overflow()
peek()
read()
print()
println()
listen()
write()
overflow()
Syntax
COPY
1 mySerial.overflow()
Parameters
None.
Returns
Boolean.
Example
COPY
See also
SoftwareSerial()
available()
begin()
isListening()
peek()
read()
print()
println()
listen()
write()
peek()
Return a character that was received on the RX pin of the software serial port.
Unlike read(), however, subsequent calls to this function will return the same
character. Note that only one SoftwareSerial object can receive incoming data
at a time (select which one with the listen() function).
Syntax
COPY
1 mySerial.peek()
Parameters
None.
Returns
Example
COPY
See also
SoftwareSerial()
available()
begin()
isListening()
overflow()
read()
print()
println()
listen()
write()
read()
Syntax
COPY
1 mySerial.read()
Parameters
None.
Returns
Example
COPY
See also
SoftwareSerial()
available()
begin()
isListening()
overflow()
peek()
print()
println()
listen()
write()
print()
Prints data to the transmit pin of the SoftwareSerial object. Works the same as
the Serial.print() function.
Syntax
COPY
1 mySerial.print(val)
Parameters
Returns
Example
COPY
See also
SoftwareSerial()
available()
begin()
isListening()
overflow()
peek()
read()
print()
println()
listen()
write()
println()
Syntax
COPY
1 mySerial.println(val)
Parameters
Returns
Example
COPY
See also
SoftwareSerial()
available()
begin()
isListening()
overflow()
peek()
read()
print()
listen()
write()
listen()
Syntax
COPY
1 mySerial.listen()
Parameters
None.
Returns
Example
COPY
See also
SoftwareSerial()
available()
begin()
isListening()
overflow()
peek()
read()
print()
println()
write()
write()
Prints data to the transmit pin of the SoftwareSerial object as raw bytes. Works
the same as the Serial.write()function.
Syntax
COPY
1 mySerial.write(val)
Parameters
Returns
Example
COPY
See also
SoftwareSerial()
available()
begin()
isListening()
overflow()
peek()
read()
print()
println()
listen()