Lesson 16 ADXL345

Share for us


The ADXL345 is a thin, compact triaxial accelerometer that is ideal for mobile devices, measuring static gravity acceleration in tilt detection applications and acceleration due to motion or impact. It can judge whether motion occurs by comparing the acceleration on any axis with the user’s settings.


Programming Steps

Step 1

After creating a new project, click on the Simulation icon on the left side of the page to enter the Simulation page.

Step 2

Connect the SCL of ADXL345 module to SCL of Ezblock Pi, the SDA to SDA, and then connect the VCC and GND to 3.3V and GND respectively.

Step 3

Drag a print from the Basic category to Forever.

Step 4

Get a create list with block from the Lists category and put it behind the print block. After that, click the setting icon and drag the other 3 items to the right list.

Step 5

Drag three text blocks from the Text category (the first block in Text category into the create list with block and then input Y, X and Z respectively.

Step 6

Get 3 ADXL345 get X value block from the Sensor kit category and put it to the create list with block, then change X to Y and Z. Finally place a delay block below  the print block.

Step 7

With the code flashed, you can rotate the ADXL345 to see the value changing on the Debug Monitor.