12 May 2014
; BY JOE PARDUE SMILEY’S WORKSHOP
Talking to the PC
In this chapter, we are going to learn mainly about
analog output but first let’s take a look at a very handy
Arduino class of functions: the serial class. We used a
couple of functions from that class at the end of Chapter
4: the serial.print() and serial.println() functions. This
month, we’ll discuss these in a bit more detail and add a
few more useful serial class functions to our arsenal.
Being able to communicate with an Arduino via a PC
terminal program is very handy indeed. It allows us to
transmit information from the Arduino to the PC by using
the Arduino IDE’s built-in serial monitor. It allows us to
receive commands and data from the PC to an Arduino
program. Doing this lets us open a window to see into the
Arduino that can be vital for testing software concepts and
for debugging programs — both you will get very
acquainted with as we go along.
Sending Text to the PC
When we program the Arduino, we use the IDE
(Integrated Development Environment) discussed in
Chapter 1. The IDE uses the USB connection to do the
communication through a serial port with a COM#
identifier for the PC input port that — as we saw— lets us
select from the Tools
menu. The IDE takes
care of all the
communication
between the IDE and
the Arduino to allow us
to upload programs that
we write on the PC to
run on the Arduino.
We can also use
this communications
channel to send and
receive data to/from
the PC by using the
Last month, we continued with the Arduino 101 Classroom series and discussed digital
input using a momentary pushbutton. We also learned some more software concepts,
and then ended with a lab that combined what we learned about LEDs and pushbuttons
to create a reaction time tester to analyze how quickly you can press a button after an
LED turns off. This month, we will first learn how to use the Arduino serial library and
the serial monitor to communicate between the Arduino and a PC — something we’ll
need for setting values for analog output. After that, we will discuss the differences
between analog and digital, then learn to output analog signals to control the
brightness of an LED and the angular position of a servomotor. All of this will add some
very useful tools to your personal computing and electronics toolkit.
The Arduino Classroom
Arduino 101 — Chapter 5:
Analog Output
; FIGURE 2: Select the Serial Port.
; FIGURE 1: Open the
Serial Monitor.