// ESP8266+ADXL345-Rohdaten_auslesen.ino - modifiziert aus https://wolles-elektronikkiste.de/adxl345-teil-1 #include #include #define ADXL345_I2CADDR 0x53 ADXL345_WE myAcc = ADXL345_WE(ADXL345_I2CADDR); void setup(){ Serial.begin(9600); Serial.println("\n\n ADXL345 Rohdaten auslesen.ino\n"); Wire.begin(); while (!myAcc.init()){ Serial.println("ADXL345 not connected!"); } myAcc.setDataRate(ADXL345_DATA_RATE_50); myAcc.setRange(ADXL345_RANGE_4G); pinMode(2,OUTPUT); } void loop() { xyzFloat raw = myAcc.getRawValues(); char buffer[60]; sprintf(buffer, "%.0f,%.0f,%.0f", raw.x, raw.y, raw.z); Serial.println(buffer); delay(333); digitalWrite(2,not digitalRead(2)); }