CHAPTER5
Serial Communication
After reading this chapter, you will be familiar with the following functions:
- if (Serial)
- available()
- begin()
- end()
- find()
- findUntil()
- parseFloat()
- parseInt()
- peek()
- print()
- println()
- read()
- readBytes()
- readBytesUntil()
- setTime-out()
- write()
The following hardware is required to complete the activities and examples presented in this chapter:
- Arduino Uno
- USB Cable
The code download for this chapter is found at http://www.wiley.com/go/arduinosketches on the Download Code tab. The code is in the Chapter 5 folder and the filename is chapter5.ino.
Introducing Serial Communication
The original IBM PC, introduced in 1981, came with two serial ports, physical connectors allowing the computer to connect to devices or another computer via the RS-232 protocol. For most people, this was the beginning of the serial port, but in reality, it started much earlier. Early computers had serial ports, and they have even been used on mainframes. They have been in use almost since the beginning of microprocessor-based computers.
The word serial comes from the way data is transmitted; serial devices send bits one at a time on a single wire. This is something that you have seen before; it is like a telephone call. Both users pick up the telephone and a single wire connects them together. Both users can talk at the same time (even if it is considered polite to listen while the other person talks), and words are sent one at a time. Both sides are free to start talking ...
Get Arduino Sketches: Tools and Techniques for Programming Wizardry now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.