Search wiring.org.co:

Reference for Wiring version 0024+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Class | Serial
Name | ### begin()
Examples |
    int val;

    void setup() {
      Serial.begin(9600);  // Start serial Serial at 9600 baud
    }

    void loop() {
      if( Serial.available() > 0 )  // if data is available to read
      {
        val = Serial.read();        // read it and store it in 'val'
      }
      analogWrite(0, val);
    }
    int val;

    void setup() {
      Serial1.begin(115200);  // Start serial Serial1 at 115200 baud
    }

    void loop() {
      if( Serial1.available() > 0 )  // if data is available to read
      {
        val = Serial1.read();        // read it and store it in 'val'
      }
      analogWrite(0, val);
    }
Description | The Wiring serial library allows for easily reading and writing data to external machines. The serial port is a nine pin I/O port that exists on most PCs and can be emulated through USB on Macintosh with the Keyspan USB Serial Adaptor. The begin(rate) method must be placed in the setup() method.
Syntax |
    serial.begin(rate)
Parameters |
rate | Integer specifying the speed: 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600 or 115200
serial | The hardware serial port, it can be Serial or Serial1
Returns | None
Usage | Application

Updated on November 02, 2009 12:14:23am PST