O'Reilly logo

Wearable-Tech Projects with the Raspberry Pi Zero by Jon Witts

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing our accelerometer

We are now ready to test our ADXL345 to check that we can read the data from it into Python. Power up your Pi Zero and connect to it over SSH. Move into your project directory by typing cd WearableTech, and then make a new directory for this chapter by typing mkdir Chapter4 ; and now move into that new directory by typing cd Chapter4.

Pimoroni has provided a Python library for the Adafruit ADXL345 accelerometer, which is available on their GitHub page at https://github.com/pimoroni/adxl345-python ; however, this library is written for Python 2, and we are using Python 3. I have cloned this repository in GitHub and adjusted it so that it works for Python 3. We will make use of this library to access and test our ADXL345. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required