ADXL345 Hookup Guide

Pages
Contributors: TheDarkSaint
Favorited Favorite 3

SparkFun ADXL345 Library

The most exciting part of the Hookup Guide is the SparkFun ADXL345 library we've put together for you. Now, you not only have the ability to customize your sensing functions but also switch easily back and forth between I2C and SPI communication.

To get started, you can download the library here along with example code. For the most up-to-date code visit the SparkFun ADXL345 Arduino Library Repo.

SparkFun ADXL345 Library and Example Code

The downloaded file includes:

  • Library .cpp and .h files
  • Arduino Sketch: ADXL345 Calibration Example
  • Arduino Sketch: ADXL345 Example
  • Arduino Sketch: SparkFun Baby Blynk Monitor Thing Example
  • README.md
  • keywords.txt

Before we are able to use the example code, we need to place the SparkFun_ADXL345_Library folder into your Arduino Library. If you don't know where that is located, you can usually find it here:

PC: My Documents > Arduino > Libraries
Mac: (home directory) > Documents > Arduino > libraries
Linux: (home directory) > Sketchbook > Libraries

For help installing the library, check out our Installing an Arduino Library tutorial.

Using the SparkFun ADXL245 Library

Once you've installed the SparkFun ADXL345 Library, you can open up SparkFun_ADXL345_Example.ino in the Arduino IDE.

Make sure you have downloaded and installed the Arduino Software IDE so you can open the example code and program your board.