Serial \ Libraries \ Wiring 1.0 (ALPHA)

| Libraries

| The Wiring Serial library allows for easily reading and writing data to and from external machines. It allows two machines to communicate and gives you the flexibility to make your own microcontroller devices and use them as the input or output to your Wiring programs. The serial port is a nine pin I/O port that exists on most PCs and can be emulated through USB on Macintosh and PCs with the Keyspan USB Serial adaptor. The Wiring I/O board has two built-in (hardware) serial ports called Serial and Serial1. The port Serial is available through the USB connector in the Wiring I/O board. The port Serial1 is available on Wiring I/O pins 2(Rx) and 3(Tx). |  | Serial Wiring serial port available through the USB port or Wiring I/O pins 32(Rx) and 33(Tx). Serial1 Wiring serial port available on Wiring I/O pins 2 (Rx) and 3(Tx) begin() Opens the serial port for reading and writing. print() Writes an int, float, byte, char, char[] or a number in decimal, hexadecimal, octal or binary base to the serial port. println() It works as the print method but prints a new line character at the end of each call. available() Returns the number of bytes available. read() Returns a number between 0 and 255 for the next byte that's waiting in the buffer. Returns -1 if there is no byte, although this should be avoided by first checking available() to see if data is available. flush() Flushes the serial port buffer. Further calls to read() and available() will return data received after the flush() command was issued. |  |