#include #include #include Adafruit_ADXL345_Unified accel = Adafruit_ADXL345_Unified(12345); void displaySensorDetails(void) { sensor_t sensor; accel.getSensor(&sensor); Serial.println("------------------------------------"); Serial.print("Sensor: "); Serial.println(sensor.name); Serial.print("Driver Ver: "); Serial.println(sensor.version); Serial.print("Unique ID: "); Serial.println(sensor.sensor_id); Serial.print("Max Value: "); Serial.print(sensor.max_value); Serial.println(" m/s^2"); Serial.print("Min Value: "); Serial.print(sensor.min_value); Serial.println(" m/s^2"); Serial.print("Resolution: "); Serial.print(sensor.resolution); Serial.println(" m/s^2"); Serial.println("------------------------------------"); Serial.println(""); delay(500); } void setup(void) { Wire.begin(6, 7); // SDA = GPIO6, SCL = GPIO7 Serial.begin(115200); while (!Serial); Serial.println("Accelerometer Test\n"); if (!accel.begin(0x53)) { Serial.println("❌ Its not detecting the ADXL345... Verify the connections."); while (1); } accel.setRange(ADXL345_RANGE_16_G); displaySensorDetails(); } //without graphic /* void loop(void) { sensors_event_t event; accel.getEvent(&event); Serial.print("X: "); Serial.print(event.acceleration.x); Serial.print(" "); Serial.print("Y: "); Serial.print(event.acceleration.y); Serial.print(" "); Serial.print("Z: "); Serial.print(event.acceleration.z); Serial.print(" "); Serial.println("m/s^2"); delay(500); } */ // Plot acceleration void loop(void) { sensors_event_t event; accel.getEvent(&event); Serial.print("X:"); Serial.print(event.acceleration.x); Serial.print(" "); Serial.print("Y:"); Serial.print(event.acceleration.y); Serial.print(" "); Serial.print("Z:"); Serial.println(event.acceleration.z); // Usa println solo en el último valor delay(100); } Here you can see a demonstrative video with X, Y and Z accelerations: