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.
After creating a new project, click on the Simulation icon on the left side of the page to enter the Simulation page.
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.
Drag a print from the Basic category to Forever.
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.
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.
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.
With the code flashed, you can rotate the ADXL345 to see the value changing on the Debug Monitor.