• You can control many devices using serial communication, but the regular
Arduino has only one serial port. If you need more, take a look at the
Arduino Due, which has four serial ports.
2
• A Universal Asynchronous Receiver/Transmitter (UART)
3
device supports
serial communication on the Arduino. This device handles serial commu-
nication while the CPU takes care of other tasks. This greatly improves
the system’s overall performance. The UART uses digital pins 0 (RX) and
1 (TX), which means you cannot use them for other purposes when com-
municating on the serial port. If you need them, you can disable serial
communication using
Serial.end()
.
• With the SoftwareSerial
4
library, you can use any digital pin for serial
communication. It has some limitations, but it is sufficient for most
applications.
In this chapter, you saw how to communicate with the Arduino using the
serial port, which opens the door to a whole new world of physical computing
projects. (See Learning More About Serial Communication, on page 253, for more
details about serial communication.) In the next chapters, you’ll learn how
to gather interesting facts about the real world using sensors, and you’ll learn
how to change the real world by moving objects. Serial communication is the
basis for letting you control all of these actions using the Arduino and your
PC.
What If It Doesn’t Work?
If anything goes wrong with the examples in this chapter, you should take a
look at What If It Doesn’t Work?, on page 21, first. If you still run into problems,
it may be because of some issues with serial communication. You might have
set the wrong baud rate; in the following figure, you can see what happens
in such a case.
2.
http://arduino.cc/en/Main/arduinoBoardDue
3.
http://en.wikipedia.org/wiki/UART
4.
http://www.arduino.cc/en/Reference/SoftwareSerial
report erratum • discuss
What If It Doesn’t Work? • 35
www.it-ebooks.info