Loading...

Tutorial.SoftwareSerialExample History

Hide minor edits - Show changes to markup

March 06, 2013, at 06:50 AM by Scott Fitzgerald -
Changed lines 5-9 from:

Arduinos have built in support for serial communication on pins 0 and 1, but what if you need more serial ports? The SoftwareSerial Library has been developed to allow serial communication to take place on the other digital pins of your Arduino, using software to replicate the functionality of the hardwired RX and TX lines. This can be extremely helpful when the need arises to communicate with two serial enabled devices, or to talk with just one device while leaving the main serial port open for debugging purpose.

In the example below, digital pins 2 and 3 on your Arduino are used as virtual RX and TX serial lines. The virtual RX pin is set up to listen for anything coming in on via the main serial line, and to then echo that data out the virtual TX line. Conversely, anything received on the virtual RX is sent out over the hardware TX.

to:

Arduinos have built in support for serial communication on pins 0 and 1, but what if you need more serial ports? The SoftwareSerial Library has been developed to allow serial communication to take place on the other digital pins of your Arduino, using software to replicate the functionality of the hardwired RX and TX lines. This can be extremely helpful when the need arises to communicate with two serial enabled devices, or to talk with just one device while leaving the main serial port open for debugging purpose.

In the example below, digital pins 10 and 11 on your Arduino are used as virtual RX and TX serial lines. The virtual RX pin is set up to listen for anything coming in on via the main serial line, and to then echo that data out the virtual TX line. Conversely, anything received on the virtual RX is sent out over the hardware TX.

November 15, 2011, at 10:39 PM by Scott Fitzgerald -
Changed line 27 from:

(:source http://github.com/arduino/Arduino/raw/new-extension/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino lang=arduino tabwidth=4:)

to:

(:source http://github.com/arduino/Arduino/raw/master/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino lang=arduino tabwidth=4:)

October 28, 2011, at 04:21 PM by Scott Fitzgerald - Page Creation
October 28, 2011, at 04:20 PM by Scott Fitzgerald - Page Creation
Added lines 1-38:

Examples > Software Serial Library

Software Serial Example

Arduinos have built in support for serial communication on pins 0 and 1, but what if you need more serial ports? The SoftwareSerial Library has been developed to allow serial communication to take place on the other digital pins of your Arduino, using software to replicate the functionality of the hardwired RX and TX lines. This can be extremely helpful when the need arises to communicate with two serial enabled devices, or to talk with just one device while leaving the main serial port open for debugging purpose.

In the example below, digital pins 2 and 3 on your Arduino are used as virtual RX and TX serial lines. The virtual RX pin is set up to listen for anything coming in on via the main serial line, and to then echo that data out the virtual TX line. Conversely, anything received on the virtual RX is sent out over the hardware TX.

(:div class=BOM :)

Hardware Required

  • Arduino Board

(:divend:)

Circuit

(:div class=circuit :) There is no circuit for this example. Make sure that your Arduino is attached to your computer via USB to enable serial communication.

image developed using Fritzing. For more circuit examples, see the Fritzing project page

(:divend:)

Code

(:div class=code :)

(:source http://github.com/arduino/Arduino/raw/new-extension/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino lang=arduino tabwidth=4:)

(:divend:)

See also




Bookmark and Share