-
Notifications
You must be signed in to change notification settings - Fork 0
Game modes
These functions allow access to MiP's built-in game modes.
- enableAppMode()
- enableCageMode()
- enableDanceMode()
- enableStackMode()
- enableTrickMode()
- enableRoamMode()
- isAppModeEnabled()
- isCageModeEnabled()
- isDanceModeEnabled()
- isStackModeEnabled()
- isTrickModeEnabled()
- isRoamModeEnabled()
void enableAppMode()
Place MiP in app mode. The chest LED will turn green. App mode allows MiP to interface with applications running on either the UART port or via Bluetooth.
None
Nothing
#include <mip_esp8266.h>
MiP mip;
// Use short delays for bench testing with serial monitor
// or long delays to see it in action.
int delayPeriod = 10000;
void setup() {
// First need to initialize the serial connection with MiP.
bool connectResult = mip.begin();
if (!connectResult) {
Serial.println(F("Failed connecting to MiP!"));
return;
}
Serial.println(F("EnableGameMode.ino - Cycles through each mode available."));
delay(500);
}
void loop() {
mip.enableCageMode();
if (mip.isCageModeEnabled()) {
Serial.println(F("Cage mode enabled."));
}
delay(delayPeriod);
mip.enableDanceMode();
if (mip.isDanceModeEnabled()) {
Serial.println(F("Dance mode enabled."));
}
delay(delayPeriod);
mip.enableStackMode();
if (mip.isStackModeEnabled()) {
Serial.println(F("Stack mode enabled."));
}
delay(delayPeriod);
mip.enableTrickMode();
if (mip.isTrickModeEnabled()) {
Serial.println(F("Trick mode enabled."));
}
delay(delayPeriod);
mip.enableRoamMode();
if (mip.isRoamModeEnabled()) {
Serial.println(F("Roam mode enabled."));
}
delay(delayPeriod);
mip.enableAppMode();
if (mip.isAppModeEnabled()) {
Serial.println(F("App mode enabled."));
}
delay(delayPeriod);
}
void enableCageMode()
Place MiP in cage mode. The chest LED will turn white and the MiP will try to escape from you. Place your hand in front of MiP's eyes to block its path. MiP moves faster as the game progesses and makes victory sounds if it escapes from you. To restart the game, clap twice.
None
Nothing
#include <mip_esp8266.h>
MiP mip;
// Use short delays for bench testing with serial monitor
// or long delays to see it in action.
int delayPeriod = 10000;
void setup() {
// First need to initialize the serial connection with MiP.
bool connectResult = mip.begin();
if (!connectResult) {
Serial.println(F("Failed connecting to MiP!"));
return;
}
Serial.println(F("EnableGameMode.ino - Cycles through each mode available."));
delay(500);
}
void loop() {
mip.enableCageMode();
if (mip.isCageModeEnabled()) {
Serial.println(F("Cage mode enabled."));
}
delay(delayPeriod);
mip.enableDanceMode();
if (mip.isDanceModeEnabled()) {
Serial.println(F("Dance mode enabled."));
}
delay(delayPeriod);
mip.enableStackMode();
if (mip.isStackModeEnabled()) {
Serial.println(F("Stack mode enabled."));
}
delay(delayPeriod);
mip.enableTrickMode();
if (mip.isTrickModeEnabled()) {
Serial.println(F("Trick mode enabled."));
}
delay(delayPeriod);
mip.enableRoamMode();
if (mip.isRoamModeEnabled()) {
Serial.println(F("Roam mode enabled."));
}
delay(delayPeriod);
mip.enableAppMode();
if (mip.isAppModeEnabled()) {
Serial.println(F("App mode enabled."));
}
delay(delayPeriod);
}
void enableDanceMode()
Place MiP in dance mode. The chest LED will turn turquoise and MiP will dance around and play music.
None
Nothing
#include <mip_esp8266.h>
MiP mip;
// Use short delays for bench testing with serial monitor
// or long delays to see it in action.
int delayPeriod = 10000;
void setup() {
// First need to initialize the serial connection with MiP.
bool connectResult = mip.begin();
if (!connectResult) {
Serial.println(F("Failed connecting to MiP!"));
return;
}
Serial.println(F("EnableGameMode.ino - Cycles through each mode available."));
delay(500);
}
void loop() {
mip.enableCageMode();
if (mip.isCageModeEnabled()) {
Serial.println(F("Cage mode enabled."));
}
delay(delayPeriod);
mip.enableDanceMode();
if (mip.isDanceModeEnabled()) {
Serial.println(F("Dance mode enabled."));
}
delay(delayPeriod);
mip.enableStackMode();
if (mip.isStackModeEnabled()) {
Serial.println(F("Stack mode enabled."));
}
delay(delayPeriod);
mip.enableTrickMode();
if (mip.isTrickModeEnabled()) {
Serial.println(F("Trick mode enabled."));
}
delay(delayPeriod);
mip.enableRoamMode();
if (mip.isRoamModeEnabled()) {
Serial.println(F("Roam mode enabled."));
}
delay(delayPeriod);
mip.enableAppMode();
if (mip.isAppModeEnabled()) {
Serial.println(F("App mode enabled."));
}
delay(delayPeriod);
}
void enableStackMode()
Place MiP in stack mode. The chest LED will turn pink and MiP will play the stack game with you. You will have only a few seconds to stack a heavy object or many light objects on top of the tray. If it can balance correctly, MiP will add additional time for you to stack. If you fail to reset the timer and the clock runs out, MiP spins around, tossing all the stacked items off the tray.
None
Nothing
#include <mip_esp8266.h>
MiP mip;
// Use short delays for bench testing with serial monitor
// or long delays to see it in action.
int delayPeriod = 10000;
void setup() {
// First need to initialize the serial connection with MiP.
bool connectResult = mip.begin();
if (!connectResult) {
Serial.println(F("Failed connecting to MiP!"));
return;
}
Serial.println(F("EnableGameMode.ino - Cycles through each mode available."));
delay(500);
}
void loop() {
mip.enableCageMode();
if (mip.isCageModeEnabled()) {
Serial.println(F("Cage mode enabled."));
}
delay(delayPeriod);
mip.enableDanceMode();
if (mip.isDanceModeEnabled()) {
Serial.println(F("Dance mode enabled."));
}
delay(delayPeriod);
mip.enableStackMode();
if (mip.isStackModeEnabled()) {
Serial.println(F("Stack mode enabled."));
}
delay(delayPeriod);
mip.enableTrickMode();
if (mip.isTrickModeEnabled()) {
Serial.println(F("Trick mode enabled."));
}
delay(delayPeriod);
mip.enableRoamMode();
if (mip.isRoamModeEnabled()) {
Serial.println(F("Roam mode enabled."));
}
delay(delayPeriod);
mip.enableAppMode();
if (mip.isAppModeEnabled()) {
Serial.println(F("App mode enabled."));
}
delay(delayPeriod);
}
void enableTrickMode()
Place MiP in trick mode. The chest LED will flash red. While the chest LED is flashing MiP will record your hand gestures. MiP will signal each successful gesture by saying "OK" and lighting up its eyes. You can record up to 50 gestures. When complete, clap twice and MiP will replay the movements given by your gestures.
None
Nothing
#include <mip_esp8266.h>
MiP mip;
// Use short delays for bench testing with serial monitor
// or long delays to see it in action.
int delayPeriod = 10000;
void setup() {
// First need to initialize the serial connection with MiP.
bool connectResult = mip.begin();
if (!connectResult) {
Serial.println(F("Failed connecting to MiP!"));
return;
}
Serial.println(F("EnableGameMode.ino - Cycles through each mode available."));
delay(500);
}
void loop() {
mip.enableCageMode();
if (mip.isCageModeEnabled()) {
Serial.println(F("Cage mode enabled."));
}
delay(delayPeriod);
mip.enableDanceMode();
if (mip.isDanceModeEnabled()) {
Serial.println(F("Dance mode enabled."));
}
delay(delayPeriod);
mip.enableStackMode();
if (mip.isStackModeEnabled()) {
Serial.println(F("Stack mode enabled."));
}
delay(delayPeriod);
mip.enableTrickMode();
if (mip.isTrickModeEnabled()) {
Serial.println(F("Trick mode enabled."));
}
delay(delayPeriod);
mip.enableRoamMode();
if (mip.isRoamModeEnabled()) {
Serial.println(F("Roam mode enabled."));
}
delay(delayPeriod);
mip.enableAppMode();
if (mip.isAppModeEnabled()) {
Serial.println(F("App mode enabled."));
}
delay(delayPeriod);
}
void enableRoamMode()
Place MiP in roam mode. The chest LED will turn yellow and roam freely, avoiding obstacles detected by the IR sensors.
None
Nothing
#include <mip_esp8266.h>
MiP mip;
// Use short delays for bench testing with serial monitor
// or long delays to see it in action.
int delayPeriod = 10000;
void setup() {
// First need to initialize the serial connection with the MiP.
bool connectResult = mip.begin();
if (!connectResult) {
Serial.println(F("Failed connecting to MiP!"));
return;
}
Serial.println(F("EnableGameMode.ino - Cycles through each mode available."));
delay(500);
}
void loop() {
mip.enableCageMode();
if (mip.isCageModeEnabled()) {
Serial.println(F("Cage mode enabled."));
}
delay(delayPeriod);
mip.enableDanceMode();
if (mip.isDanceModeEnabled()) {
Serial.println(F("Dance mode enabled."));
}
delay(delayPeriod);
mip.enableStackMode();
if (mip.isStackModeEnabled()) {
Serial.println(F("Stack mode enabled."));
}
delay(delayPeriod);
mip.enableTrickMode();
if (mip.isTrickModeEnabled()) {
Serial.println(F("Trick mode enabled."));
}
delay(delayPeriod);
mip.enableRoamMode();
if (mip.isRoamModeEnabled()) {
Serial.println(F("Roam mode enabled."));
}
delay(delayPeriod);
mip.enableAppMode();
if (mip.isAppModeEnabled()) {
Serial.println(F("App mode enabled."));
}
delay(delayPeriod);
}
bool isAppModeEnabled()
Returns whether MiP is in app mode.
None
- true if MiP was successfully placed in app mode with a previous call to enableAppMode().
- false if MiP is not in app mode.
#include <mip_esp8266.h>
MiP mip;
// Use short delays for bench testing with serial monitor
// or long delays to see it in action.
int delayPeriod = 10000;
void setup() {
// First need to initialize the serial connection with MiP.
bool connectResult = mip.begin();
if (!connectResult) {
Serial.println(F("Failed connecting to MiP!"));
return;
}
Serial.println(F("EnableGameMode.ino - Cycles through each mode available."));
delay(500);
}
void loop() {
mip.enableCageMode();
if (mip.isCageModeEnabled()) {
Serial.println(F("Cage mode enabled."));
}
delay(delayPeriod);
mip.enableDanceMode();
if (mip.isDanceModeEnabled()) {
Serial.println(F("Dance mode enabled."));
}
delay(delayPeriod);
mip.enableStackMode();
if (mip.isStackModeEnabled()) {
Serial.println(F("Stack mode enabled."));
}
delay(delayPeriod);
mip.enableTrickMode();
if (mip.isTrickModeEnabled()) {
Serial.println(F("Trick mode enabled."));
}
delay(delayPeriod);
mip.enableRoamMode();
if (mip.isRoamModeEnabled()) {
Serial.println(F("Roam mode enabled."));
}
delay(delayPeriod);
mip.enableAppMode();
if (mip.isAppModeEnabled()) {
Serial.println(F("App mode enabled."));
}
delay(delayPeriod);
}
bool isCageModeEnabled()
Returns whether MiP is in cage mode.
None
- true if MiP was successfully placed in cage mode with a previous call to enableCageMode().
- false if MiP is not in cage mode.
#include <mip_esp8266.h>
MiP mip;
// Use short delays for bench testing with serial monitor
// or long delays to see it in action.
int delayPeriod = 10000;
void setup() {
// First need to initialize the serial connection with MiP.
bool connectResult = mip.begin();
if (!connectResult) {
Serial.println(F("Failed connecting to MiP!"));
return;
}
Serial.println(F("EnableGameMode.ino - Cycles through each mode available."));
delay(500);
}
void loop() {
mip.enableCageMode();
if (mip.isCageModeEnabled()) {
Serial.println(F("Cage mode enabled."));
}
delay(delayPeriod);
mip.enableDanceMode();
if (mip.isDanceModeEnabled()) {
Serial.println(F("Dance mode enabled."));
}
delay(delayPeriod);
mip.enableStackMode();
if (mip.isStackModeEnabled()) {
Serial.println(F("Stack mode enabled."));
}
delay(delayPeriod);
mip.enableTrickMode();
if (mip.isTrickModeEnabled()) {
Serial.println(F("Trick mode enabled."));
}
delay(delayPeriod);
mip.enableRoamMode();
if (mip.isRoamModeEnabled()) {
Serial.println(F("Roam mode enabled."));
}
delay(delayPeriod);
mip.enableAppMode();
if (mip.isAppModeEnabled()) {
Serial.println(F("App mode enabled."));
}
delay(delayPeriod);
}
bool isDanceModeEnabled()
Returns whether the MiP is in dance mode.
None
- true if MiP was successfully placed in dance mode with a previous call to enableDanceMode().
- false if MiP is not in dance mode.
#include <mip_esp8266.h>
MiP mip;
// Use short delays for bench testing with serial monitor
// or long delays to see it in action.
int delayPeriod = 10000;
void setup() {
// First need to initialize the serial connection with MiP.
bool connectResult = mip.begin();
if (!connectResult) {
Serial.println(F("Failed connecting to MiP!"));
return;
}
Serial.println(F("EnableGameMode.ino - Cycles through each mode available."));
delay(500);
}
void loop() {
mip.enableCageMode();
if (mip.isCageModeEnabled()) {
Serial.println(F("Cage mode enabled."));
}
delay(delayPeriod);
mip.enableDanceMode();
if (mip.isDanceModeEnabled()) {
Serial.println(F("Dance mode enabled."));
}
delay(delayPeriod);
mip.enableStackMode();
if (mip.isStackModeEnabled()) {
Serial.println(F("Stack mode enabled."));
}
delay(delayPeriod);
mip.enableTrickMode();
if (mip.isTrickModeEnabled()) {
Serial.println(F("Trick mode enabled."));
}
delay(delayPeriod);
mip.enableRoamMode();
if (mip.isRoamModeEnabled()) {
Serial.println(F("Roam mode enabled."));
}
delay(delayPeriod);
mip.enableAppMode();
if (mip.isAppModeEnabled()) {
Serial.println(F("App mode enabled."));
}
delay(delayPeriod);
}
bool isStackModeEnabled()
Returns whether MiP is in stack mode.
None
- true if MiP was successfully placed in stack mode with a previous call to enableStackMode().
- false if MiP is not in stack mode.
#include <mip_esp8266.h>
MiP mip;
// Use short delays for bench testing with serial monitor
// or long delays to see it in action.
int delayPeriod = 10000;
void setup() {
// First need to initialize the serial connection with MiP.
bool connectResult = mip.begin();
if (!connectResult) {
Serial.println(F("Failed connecting to MiP!"));
return;
}
Serial.println(F("EnableGameMode.ino - Cycles through each mode available."));
delay(500);
}
void loop() {
mip.enableCageMode();
if (mip.isCageModeEnabled()) {
Serial.println(F("Cage mode enabled."));
}
delay(delayPeriod);
mip.enableDanceMode();
if (mip.isDanceModeEnabled()) {
Serial.println(F("Dance mode enabled."));
}
delay(delayPeriod);
mip.enableStackMode();
if (mip.isStackModeEnabled()) {
Serial.println(F("Stack mode enabled."));
}
delay(delayPeriod);
mip.enableTrickMode();
if (mip.isTrickModeEnabled()) {
Serial.println(F("Trick mode enabled."));
}
delay(delayPeriod);
mip.enableRoamMode();
if (mip.isRoamModeEnabled()) {
Serial.println(F("Roam mode enabled."));
}
delay(delayPeriod);
mip.enableAppMode();
if (mip.isAppModeEnabled()) {
Serial.println(F("App mode enabled."));
}
delay(delayPeriod);
}
bool isTrickModeEnabled()
Returns whether MiP is in trick mode.
None
- true if MiP was successfully placed in trick mode with a previous call to enableTrickMode().
- false if MiP is not in trick mode.
#include <mip_esp8266.h>
MiP mip;
// Use short delays for bench testing with serial monitor
// or long delays to see it in action.
int delayPeriod = 10000;
void setup() {
// First need to initialize the serial connection with MiP.
bool connectResult = mip.begin();
if (!connectResult) {
Serial.println(F("Failed connecting to MiP!"));
return;
}
Serial.println(F("EnableGameMode.ino - Cycles through each mode available."));
delay(500);
}
void loop() {
mip.enableCageMode();
if (mip.isCageModeEnabled()) {
Serial.println(F("Cage mode enabled."));
}
delay(delayPeriod);
mip.enableDanceMode();
if (mip.isDanceModeEnabled()) {
Serial.println(F("Dance mode enabled."));
}
delay(delayPeriod);
mip.enableStackMode();
if (mip.isStackModeEnabled()) {
Serial.println(F("Stack mode enabled."));
}
delay(delayPeriod);
mip.enableTrickMode();
if (mip.isTrickModeEnabled()) {
Serial.println(F("Trick mode enabled."));
}
delay(delayPeriod);
mip.enableRoamMode();
if (mip.isRoamModeEnabled()) {
Serial.println(F("Roam mode enabled."));
}
delay(delayPeriod);
mip.enableAppMode();
if (mip.isAppModeEnabled()) {
Serial.println(F("App mode enabled."));
}
delay(delayPeriod);
}
bool isRoamModeEnabled()
Returns whether MiP is in roam mode.
None
- true if MiP was successfully placed in roam mode with a previous call to enableRoamMode().
- false if MiP is not in roam mode.
#include <mip_esp8266.h>
MiP mip;
// Use short delays for bench testing with serial monitor
// or long delays to see it in action.
int delayPeriod = 10000;
void setup() {
// First need to initialize the serial connection with MiP.
bool connectResult = mip.begin();
if (!connectResult) {
Serial.println(F("Failed connecting to MiP!"));
return;
}
Serial.println(F("EnableGameMode.ino - Cycles through each mode available."));
delay(500);
}
void loop() {
mip.enableCageMode();
if (mip.isCageModeEnabled()) {
Serial.println(F("Cage mode enabled."));
}
delay(delayPeriod);
mip.enableDanceMode();
if (mip.isDanceModeEnabled()) {
Serial.println(F("Dance mode enabled."));
}
delay(delayPeriod);
mip.enableStackMode();
if (mip.isStackModeEnabled()) {
Serial.println(F("Stack mode enabled."));
}
delay(delayPeriod);
mip.enableTrickMode();
if (mip.isTrickModeEnabled()) {
Serial.println(F("Trick mode enabled."));
}
delay(delayPeriod);
mip.enableRoamMode();
if (mip.isRoamModeEnabled()) {
Serial.println(F("Roam mode enabled."));
}
delay(delayPeriod);
mip.enableAppMode();
if (mip.isAppModeEnabled()) {
Serial.println(F("App mode enabled."));
}
delay(delayPeriod);
}