Reference Language (extended) | Libraries | Comparison | Changes
Sets the speed (baud rate) for the serial communication. Using speeds higher than 9600 baud will result in faulty communication.
speed: the baud rate (long)
none
// include the SoftwareSerial library so you can use its functions:
#include <SoftwareSerial.h>
#define rxPin 2
#define txPin 3
// set up a new serial port
SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);
void setup()  {
  // define pin modes for tx, rx:
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
}
void loop() {
  // ...
}
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.