Hardware Reference
In-Depth Information
For example, to open the serial port on an Arduino board
(discussed shortly) at 9600 bits per second, you might
type
screen
/dev/tty.usbmodem241241 9600
on Mac OS
X. On Linux, the command might be
screen
/dev/ttyUSB0
9600
. The screen will be cleared, and any characters you
type will be sent out the serial port you opened. They won't
show up on the screen, however. Any bytes received in the
serial port will be displayed in the window as characters. To
close the serial port, type
Ctrl-A
followed by
Ctrl-\
.
microcontroller family, Atmel's ATmega series (
www.
atmel.com
), and they're both programmed in C/C++.
The "dialect" they speak is based on Processing, as is the
software
integrated development environments
(
IDE
s)
they use. You'll see that some Processing commands
have made their way into Arduino and Wiring, such as the
setup()
and
loop()
methods (Processing's
draw()
method
was originally called
loop()
), the
map()
function, and more.
When this topic was first written, there was one Wiring
board, four or five variants of Arduino, and almost no deriv-
atives. Now, there are several Arduino models, two new
Wiring models coming out shortly, and scores of Arduino-
compatible derivatives, most of which are compatible
enough that you can program them directly from the
Arduino IDE. Others have their own IDEs and will work with
some (but not all) of the code in this topic. Still others are
compatible in their physical design but are programmed
with other languages. The derivatives cover a wide range
of applications.
In the next section, you'll use a serial communications
program to communicate with a microcontroller.
Hardware
Arduino, Wiring, and Derivatives
The main microcontroller used in this topic is the Arduino
module. Arduino and Wiring, another microcontroller
module, both came out of the Institute for Interaction
Design in Ivrea, Italy, in 2005. They're based on the same
Figure 1-7
The CoolTerm serial terminal program.