User Tools

Site Tools


arduino:communication:serial

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

arduino:communication:serial [2013/02/15 20:45]
arduino:communication:serial [2024/02/16 01:04] (current)
Line 1: Line 1:
 +======Serial   ======
 +
 +(:table:)
 +
 +(:cell width=55%:)
 +
 +Used for communication between the Arduino board and a computer or other devices.  All Arduino boards have at least one serial port (also known as a UART or USART): **Serial**.  It communicates on digital pins 0 (RX) and 1 (TX) as well as with the computer via USB.  Thus, if you use these functions, you cannot also use pins 0 and 1 for digital input or output.
 +
 +You can use the Arduino environment's built-in serial monitor to communicate with an Arduino board.  Click the serial monitor button in the toolbar and select the same baud rate used in the call to begin().
 +
 +The [[/Main/ArduinoBoardMega2560 | Arduino Mega]] has three additional serial ports: **Serial1** on pins 19 (RX) and 18 (TX),  **Serial2** on pins 17 (RX) and 16 (TX), **Serial3** on pins 15 (RX) and 14 (TX).   To use these pins to communicate with your personal computer, you will need an additional USB-to-serial adaptor, as they are not connected to the Mega's USB-to-serial adaptor. To use them to communicate with an external TTL serial device, connect the TX pin to your device's RX pin, the RX to your device's TX pin, and the ground of your Mega to your device's ground.  (Don't connect these pins directly to an RS232 serial port; they operate at +/- 12V and can damage your Arduino board.)
 +
 +The [[/Main/ArduinoBoardDue | Arduino Due]] has three additional 3.3V TTL serial ports: **Serial1** on pins 19 (RX) and 18 (TX);  **Serial2** on pins 17 (RX) and 16 (TX), **Serial3** on pins 15 (RX) and 14 (TX).  Pins 0 and 1 are also connected to the corresponding pins of the ATmega16U2 USB-to-TTL Serial chip, which is connected to the USB debug port. Additionally, there is a native USB-serial port on the SAM3X chip, ''SerialUSB**.
 +
 +The Arduino Leonardo board uses **Serial1** to communicate via TTL (5V) serial on pins 0 (RX) and 1 (TX). **Serial** is reserved for USB CDC communication. For more information, refer to the Leonardo [[/Guide/ArduinoLeonardo | getting started]] page and [[/Main/ArduinoBoardLeonardo | hardware page]]. 
 +
 +(:cell width=10%:)
 +
 +(:cell width=35%:)
 +
 +====Functions   ====
 +
 +* [[arduino:communication:Serial/IfSerial | if (Serial)]]
 +
 +* [[arduino:communication:Serial/Available | available]]
 +* [[arduino:communication:Serial/Begin | begin]]
 +* [[arduino:communication:Serial/End | end]]
 +* [[arduino:communication:Serial/Find | find]]
 +* [[arduino:communication:Serial/FindUntil | findUntil]]
 +* [[arduino:communication:Serial/Flush | flush]]
 +* [[arduino:communication:Serial/ParseFloat | parseFloat]]
 +* [[arduino:communication:Serial/ParseInt | parseInt]]
 +* [[arduino:communication:Serial/Peek | peek]]
 +* [[arduino:communication:Serial/Print | print]]
 +* [[arduino:communication:Serial/Println | println]]
 +* [[arduino:communication:Serial/Read | read]]
 +* [[arduino:communication:Serial/ReadBytes | readBytes]]
 +* [[arduino:communication:Serial/ReadBytesUntil | readBytesUntil]]
 +* [[arduino:communication:Serial/SetTimeout | setTimeout]]
 +* [[arduino:communication:Serial/Write | write]]
 +
 +* [[Reference/SerialEvent | serialEvent]]
 +
 +==== Examples   ====
 +
 +(:tableend:)
 +Source: arduino.cc
  

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War

Impressum Datenschutz