Arduino boards connect to your computer using a USB cable. The way the boards “talk” to the computer is through something called a serial port. Serial ports can be used to exchange fairly complicated data with the computer. Instead of the digital or analog signals we discussed previously, you can send or receive text (
With serial communication you can communicate with other software as well. You could for example use Arduino to read from a button and send the button state data to a processing sketch that changes the color of the screen when the button is pushed.
The serial port uses the Digital Pins 0 and 1:
- The Pin 0, RX or reception, receives the data to the Arduino.
- Pin 1, TX or transmission, sends the data from the Arduino.
Therefore, do not use the function
digitalWrite()on these pins if you use serial communication.