From the course: Learning CircuitPython with Circuit Playground Express

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using the accelerometer

Using the accelerometer - Python Tutorial

From the course: Learning CircuitPython with Circuit Playground Express

Start my 1-month free trial

Using the accelerometer

- [Instructor] Things move. And sometimes that's useful as input to your project. For example, fitness trackers use motion to measure activity. Or an alarm attached to a door can use movement to trigger an alert if the door is opened. The circuit playground express has an onboard accelerometer located in the center of the board, right next to the reset button. You can see a small XYZ printed next to it. An accelerometer doesn't measure motion exactly. It measures acceleration, which is a change in motion. For example, stopping, starting, or changing direction. Even when it's not moving, an accelerometer is measuring some acceleration because of gravity. Gravity acting on an accelerometer allows it to sense orientation as well as motion. There's a generic way to use accelerometers, but the CPX library makes it easy. You can access X, Y, and Z acceleration individually, or you can retrieve all the values at once by assigning…

Contents