What You Need
1. An Arduino Proto Shield (optional)
2. An ADXL335 accelerometer
3. A pushbutton
4. A 10kΩ resistor
5. Some wires
6. A half-size breadboard (if you’re not using a Proto Shield)
7. An Arduino board, such as the Uno, Duemilanove, or Diecimila
8. A USB cable to connect the Arduino to your computer
9. A 6-pin 0.1-inch standard header
Wiring Up the Accelerometer
There are many different accelerometers, differing mainly in the number of
spatial axes they support (usually two or three). I’ll use the ADXL335 from
Analog Devices—it’s easy to use and widely available.
1
Analog Devices offers
many more accelerometers, named ADXL345, ADXL377, or ADXL326, for
example. They all work the same, and they differ only in accuracy and price.
In this section, we’ll connect the ADXL335 to the Arduino and create a small
demo program showing the raw data the sensor delivers. At that point, we
will have a quick look at the sensor’s specification and interpret the data.
1.
http://www.analog.com/en/sensors/inertial-sensors/adxl335/products/product.html
Chapter 6. Building a Motion-Sensing Game Controller • 100
report erratum • discuss
www.it-ebooks.info