Skip to content
Tiogaplanet edited this page Oct 9, 2018 · 2 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 <mip_esp8266.h>

MiP     mip;

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

  Serial.println(F("Shake.ino - Detect shakes."));
}

void loop() {
  if (mip.hasBeenShaken()) {
    Serial.println(F("Shake detected!"));
  }
}
Clone this wiki locally