Accelerometers are advanced components that can measure acceleration. Initially, they were designed for airplanes and rockets, but now we can find them in any phone, laptop, hard drive, and a whole bunch of toys.

By measuring acceleration, we can determine if an object is moving, how rapidly it is changing direction, and benefit from its most popular use—determining the orientation of the object. Accelerometers come in various types and the number of axes they can sense is the basis of their categorization. Now, almost all accelerometers can sense three axes—meaning they can sense acceleration in any direction it happens.

In this example, we will read the data from the accelerometer and print it over a serial connection.

Getting ready ...

Get Arduino Development Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.