Skip to content
Tiogaplanet edited this page Jul 15, 2026 · 3 revisions

Read whether MiP has been shaken (robot abuse!).


hasBeenShaken()

bool hasBeenShaken()

Description

Returns whether MiP has been shaken since the previous call.

Parameters

None

Returns

  • true if MiP has been shaken by the user since the previous call.
  • false otherwise.

Example

#include <MPU_D1_mini.h>

MiP     mip;

void setup() {
  bool connectResult = mip.begin();
  if (!connectResult) {
    Serial1.println(F("Failed connecting to MiP!"));
    return;
  }

  Serial1.println(F("Shake.ino: Detect shakes."));
}

void loop() {
  if (mip.hasBeenShaken()) {
    Serial1.println(F("Shake detected!"));
  }
}

Clone this wiki locally