#include 



if (!IMU.begin()) {
  Serial.println("Failed to initialize IMU!");
  while (1);
}



void loop() {
  ArduinoCloud.update();
  // Your code here 
  if (IMU.accelerationAvailable()) {
    IMU.readAcceleration(accX, accY, accZ);

    Serial.print("Accelerometer:\t");
    Serial.print(accX);
    Serial.print('\t');
    Serial.print(accY);
    Serial.print('\t');
    Serial.println(accZ);
    Serial.println();
  }

  delay(500); 

}



void onAccelerationChange() {
  Serial.print("Accelerometer:\t");
  Serial.print(accX);
  Serial.print('\t');
  Serial.print(accY);
  Serial.print('\t');
  Serial.println(accZ);
  Serial.println();
}



void onAccXChange() {
  onAccelerationChange();
}



#define LED D0


pinMode(LED, OUTPUT);


void onAccelerationChange() {
  float accTotal = sqrt(accX * accX + accY * accY + accZ * accZ);
  if(accTotal > 2) {
    digitalWrite(D0, LOW);
  } else {
    digitalWrite(D0, HIGH);
  }
  Serial.print("Accelerometer:\t");
  Serial.println(accTotal);
}