Skip to content
Tiogaplanet edited this page Jul 28, 2018 · 39 revisions

Welcome to the MiP_ESP8266_Library wiki!

We've got a lot of stuff to sort out. In time, all this documentation will be sorted into separate pages. Unfortunately, I'm still in the middle of moving function groups into their own pages.

Examples

  • ChestLED: Take control of the RGB LED in the chest of the MiP.
  • Clap: Send descriptive messages to the Arduino IDE about each clap event deteced by the MiP robot.
  • ContinuousDrive: You want to control the motion of the MiP in real time? This is the example for you.
  • DisconnectApp: Disconnect all apps, including this sketch and any app that may be connected to Bluetooth.
  • DistanceDrive: Tell the MiP robot exactly how far to travel and forget about it.
  • DriveForwardBackward: Tell the MiP robot how long to drive forward/backward and forget about it.
  • EnableGameMode: Cycle through each of the game modes available.
  • EnableMiPDetectionMode: Allow your MiP to be discovered by others.
  • FallDown: Tired of standing around? Command MiP to fall flat on his face.
  • Gesture: Use your hand to make gesture to your MiP robot. Send descriptive messages to the Arduio IDE about each gesture event detected.
  • GestureRadarMode: Want to learn more about how to enable/disable IR based gesture and radar measurements? Check out this example.
  • GetUp: If your MiP robot falls down, learn how to have him try getting back up on his feetwheels.
  • HeadLEDs: Take control of the 4 individual eye LEDs on the MiP robot's head.
  • Odometer: How far has your MiP robot been traveling around your personal robot laboratory? This example shows you how to find out and reset its measurement.
  • PlaySound: Learn how to get the MiP robot vocalizing under your control!
  • Radar: Is there anything in front of your MiP robot? This example sends descriptive text to the Arduino IDE when it detects changes in the obstacles around it.
  • RawSendReceive: You found a command in WowWee's Protocol Specification that isn't supported by this library? This example shows you how to experiment with these new commands.
  • ReadWriteEeprom: Read and write your own data to MiP's EEPROM. This is useful for storing data across power cycles. See also ZeroEeprom.
  • ReadIRDongleCode: Reads IR signals sent from another MiP. See also SendIRDongleCode.
  • SendIRDongleCode: Sends IR signals to another MiP. See also ReadIRDongleCode.
  • SRSdemo: The MiP robot made an appearance at the Seattle Robotics Society meeting on April 21st, 2018. This is what he was running!
  • Shake: Is someone shaking your poor little MiP robot? This example shows you how to detect such rudeness and report it to the Arduino IDE.
  • SoftwareHardwareVersion: This example shows you how to peek under the covers and see what hardware / software is running inside your MiP robot.
  • Status: Detect changes in the MiP robot's battery level or pose and report them to the Arduino IDE.
  • Stop: Danger! Danger! MiP Robot! Stop your MiP robot in its tracks before it gets itself into more trouble.
  • TurnLeftRight: Tell the MiP robot exactly how many degrees to turn and forget about it.
  • Volume: Your MiP robot is too loud? Turn down the volume with this example.
  • Weight: Detect weight changes in what the MiP is carrying and report them to the Arduino IDE.
  • ZeroEeprom: Write zeroes to each available byte in EEPROM. See also ReadWriteEeprom.

Functions

Group Function
Initialization MiP()

begin()

end()

sleep()

isInitialized()
Radar enableRadarMode()

disableRadarMode()

isRadarModeEnabled()

areGestureAndRadarModesDisabled()

readRadar()
Gesture enableGestureMode()

disableGestureMode()

isGestureModeEnabled()

areGestureAndRadarModesDisabled()

availableGestureEvents()

readGestureEvent()
Chest LED writeChestLED()

readChestLED()
Head LEDs writeHeadLEDs()

readHeadLEDs()
Motion continuousDrive()

distanceDrive()

turnLeft()

turnRight()

driveForward()

driveBackward()

stop()

fallForward()

fallBackward()

getUp()
Sound playSound()

beginSoundList()

addEntryToSoundList()

playSoundList()

writeVolume()

readVolume()
Odometer readDistanceTravelled()

resetDistanceTravelled()
Battery Level readBatteryVoltage()
Position readPosition()

isOnBack()

isFaceDown()

isUpright()

isPickedUp()

isHandStanding()

isFaceDownOnTray()

isOnBackWithKickstand()
Weight readWeight()
Clap enableClapEvents()

disableClapEvents()

areClapEventsEnabled()

writeClapDelay()

readClapDelay()

availableClapEvents()

readClapEvent()
Shake hasBeenShaken()
Version Info readSoftwareVersion()

readHardwareInfo()
Game Modes enableAppMode()

enableCageMode()

enableDanceMode()

enableStackMode()

enableTrickMode()

enableRoamMode()

isAppModeEnabled()

isCageModeEnabled()

isDanceModeEnabled()

isStackModeEnabled()

isTrickModeEnabled()

isRoamModeEnabled()
EEPROM setUserData()

getUserData()
Infrared enableMiPDetectionMode()

disableMiPDetectionMode()

isMiPDetectionModeEnabled()

readDetectedMiP()

sendIRDongleCode()

readIRDongleCode()

readBatteryVoltage()

float readBatteryVoltage()

Description

Read the MiP robot's current battery level.

Parameters

None

Returns

The current battery voltage in Volts.

Notes

  • The MiP robot status updates, which include the battery level, may be lost if you are spending too much time sending output back to the Arduino IDE's serial monitor. See Limitations section above.
  • These status updates are usually sent every 30 seconds or earlier if the MiP detects a change in position.

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("Status.ino - Display MiP status as it changes."));
}

void loop() {
  static float       lastBatteryLevel = 0.0f;
  static MiPPosition lastPosition = (MiPPosition) - 1;

  float              currentBatteryLevel = mip.readBatteryVoltage();
  MiPPosition        currentPosition = mip.readPosition();

  if (currentBatteryLevel != lastBatteryLevel) {
    Serial.print(F("Battery: "));
      Serial.print(currentBatteryLevel);
      Serial.println(F("V"));
    lastBatteryLevel = currentBatteryLevel;
  }

  if (currentPosition != lastPosition) {
    if (mip.isOnBack()) {
      Serial.println(F("Position: On Back"));
    }
    if (mip.isFaceDown()) {
      Serial.println(F("Position: Face Down"));
    }
    if (mip.isUpright()) {
      Serial.println(F("Position: Upright"));
    }
    if (mip.isPickedUp()) {
      Serial.println(F("Position: Picked Up"));
    }
    if (mip.isHandStanding()) {
      Serial.println(F("Position: Hand Stand"));
    }
    if (mip.isFaceDownOnTray()) {
      Serial.println(F("Position: Face Down on Tray"));
    }
    if (mip.isOnBackWithKickstand()) {
      Serial.println(F("Position: On Back With Kickstand"));
    }

    lastPosition = currentPosition;
  }
}

readPosition()

MiPPosition readPosition()

Description

Read the MiP robot's current position.

Parameters

None

Returns

One of the values from the following table:

MiPPosition Value
MIP_POSITION_ON_BACK
MIP_POSITION_FACE_DOWN
MIP_POSITION_UPRIGHT
MIP_POSITION_PICKED_UP
MIP_POSITION_HAND_STAND
MIP_POSITION_FACE_DOWN_ON_TRAY
MIP_POSITION_ON_BACK_WITH_KICKSTAND

Notes

  • The MiP robot status updates, which include the position, may be lost if you are spending too much time sending output back to the Arduino IDE's serial monitor. See Limitations section above.
  • These status updates are usually sent every 30 seconds or earlier if the MiP detects a change in position.

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("Status.ino - Display MiP status as it changes."));
}

void loop() {
  static float       lastBatteryLevel = 0.0f;
  static MiPPosition lastPosition = (MiPPosition) - 1;

  float              currentBatteryLevel = mip.readBatteryVoltage();
  MiPPosition        currentPosition = mip.readPosition();

  if (currentBatteryLevel != lastBatteryLevel) {
    Serial.print(F("Battery: "));
      Serial.print(currentBatteryLevel);
      Serial.println(F("V"));
    lastBatteryLevel = currentBatteryLevel;
  }

  if (currentPosition != lastPosition) {
    if (mip.isOnBack()) {
      Serial.println(F("Position: On Back"));
    }
    if (mip.isFaceDown()) {
      Serial.println(F("Position: Face Down"));
    }
    if (mip.isUpright()) {
      Serial.println(F("Position: Upright"));
    }
    if (mip.isPickedUp()) {
      Serial.println(F("Position: Picked Up"));
    }
    if (mip.isHandStanding()) {
      Serial.println(F("Position: Hand Stand"));
    }
    if (mip.isFaceDownOnTray()) {
      Serial.println(F("Position: Face Down on Tray"));
    }
    if (mip.isOnBackWithKickstand()) {
      Serial.println(F("Position: On Back With Kickstand"));
    }

    lastPosition = currentPosition;
  }
}

isOnBack()

bool isOnBack()

Description

Is the MiP robot currently lying on its back?

Parameters

None

Returns

  • true if the MiP robot is currently lying on its back.
  • false otherwise.

Notes

  • The MiP robot status updates, which include the position, may be lost if you are spending too much time sending output back to the Arduino IDE's serial monitor. See Limitations section above.
  • These status updates are usually sent every 30 seconds or earlier if the MiP detects a change in position.

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("Status.ino - Display MiP status as it changes."));
}

void loop() {
  static float       lastBatteryLevel = 0.0f;
  static MiPPosition lastPosition = (MiPPosition) - 1;

  float              currentBatteryLevel = mip.readBatteryVoltage();
  MiPPosition        currentPosition = mip.readPosition();

  if (currentBatteryLevel != lastBatteryLevel) {
    Serial.print(F("Battery: "));
      Serial.print(currentBatteryLevel);
      Serial.println(F("V"));
    lastBatteryLevel = currentBatteryLevel;
  }

  if (currentPosition != lastPosition) {
    if (mip.isOnBack()) {
      Serial.println(F("Position: On Back"));
    }
    if (mip.isFaceDown()) {
      Serial.println(F("Position: Face Down"));
    }
    if (mip.isUpright()) {
      Serial.println(F("Position: Upright"));
    }
    if (mip.isPickedUp()) {
      Serial.println(F("Position: Picked Up"));
    }
    if (mip.isHandStanding()) {
      Serial.println(F("Position: Hand Stand"));
    }
    if (mip.isFaceDownOnTray()) {
      Serial.println(F("Position: Face Down on Tray"));
    }
    if (mip.isOnBackWithKickstand()) {
      Serial.println(F("Position: On Back With Kickstand"));
    }

    lastPosition = currentPosition;
  }
}

isFaceDown()

bool isFaceDown()

Description

Is the MiP robot currently lying on its front?

Parameters

None

Returns

  • true if the MiP robot is currently lying on its front.
  • false otherwise.

Notes

  • The MiP robot status updates, which include the position, may be lost if you are spending too much time sending output back to the Arduino IDE's serial monitor. See Limitations section above.
  • These status updates are usually sent every 30 seconds or earlier if the MiP detects a change in position.

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("Status.ino - Display MiP status as it changes."));
}

void loop() {
  static float       lastBatteryLevel = 0.0f;
  static MiPPosition lastPosition = (MiPPosition) - 1;

  float              currentBatteryLevel = mip.readBatteryVoltage();
  MiPPosition        currentPosition = mip.readPosition();

  if (currentBatteryLevel != lastBatteryLevel) {
    Serial.print(F("Battery: "));
      Serial.print(currentBatteryLevel);
      Serial.println(F("V"));
    lastBatteryLevel = currentBatteryLevel;
  }

  if (currentPosition != lastPosition) {
    if (mip.isOnBack()) {
      Serial.println(F("Position: On Back"));
    }
    if (mip.isFaceDown()) {
      Serial.println(F("Position: Face Down"));
    }
    if (mip.isUpright()) {
      Serial.println(F("Position: Upright"));
    }
    if (mip.isPickedUp()) {
      Serial.println(F("Position: Picked Up"));
    }
    if (mip.isHandStanding()) {
      Serial.println(F("Position: Hand Stand"));
    }
    if (mip.isFaceDownOnTray()) {
      Serial.println(F("Position: Face Down on Tray"));
    }
    if (mip.isOnBackWithKickstand()) {
      Serial.println(F("Position: On Back With Kickstand"));
    }

    lastPosition = currentPosition;
  }
}

isUpright()

bool isUpright()

Description

Is the MiP robot currently standing upright and self-balancing?

Parameters

None

Returns

  • true if the MiP robot is currently standing up right and self-balancing.
  • false otherwise.

Notes

  • The MiP robot status updates, which include the position, may be lost if you are spending too much time sending output back to the Arduino IDE's serial monitor. See Limitations section above.
  • These status updates are usually sent every 30 seconds or earlier if the MiP detects a change in position.

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("Status.ino - Display MiP status as it changes."));
}

void loop() {
  static float       lastBatteryLevel = 0.0f;
  static MiPPosition lastPosition = (MiPPosition) - 1;

  float              currentBatteryLevel = mip.readBatteryVoltage();
  MiPPosition        currentPosition = mip.readPosition();

  if (currentBatteryLevel != lastBatteryLevel) {
    Serial.print(F("Battery: "));
      Serial.print(currentBatteryLevel);
      Serial.println(F("V"));
    lastBatteryLevel = currentBatteryLevel;
  }

  if (currentPosition != lastPosition) {
    if (mip.isOnBack()) {
      Serial.println(F("Position: On Back"));
    }
    if (mip.isFaceDown()) {
      Serial.println(F("Position: Face Down"));
    }
    if (mip.isUpright()) {
      Serial.println(F("Position: Upright"));
    }
    if (mip.isPickedUp()) {
      Serial.println(F("Position: Picked Up"));
    }
    if (mip.isHandStanding()) {
      Serial.println(F("Position: Hand Stand"));
    }
    if (mip.isFaceDownOnTray()) {
      Serial.println(F("Position: Face Down on Tray"));
    }
    if (mip.isOnBackWithKickstand()) {
      Serial.println(F("Position: On Back With Kickstand"));
    }

    lastPosition = currentPosition;
  }
}

isPickedUp()

bool isPickedUp()

Description

Has the user picked the MiP robot up?

Parameters

None

Returns

  • true if the MiP robot has been picked up by the user.
  • false otherwise.

Notes

  • The MiP robot status updates, which include the position, may be lost if you are spending too much time sending output back to the Arduino IDE's serial monitor. See Limitations section above.
  • These status updates are usually sent every 30 seconds or earlier if the MiP detects a change in position.

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("Status.ino - Display MiP status as it changes."));
}

void loop() {
  static float       lastBatteryLevel = 0.0f;
  static MiPPosition lastPosition = (MiPPosition) - 1;

  float              currentBatteryLevel = mip.readBatteryVoltage();
  MiPPosition        currentPosition = mip.readPosition();

  if (currentBatteryLevel != lastBatteryLevel) {
    Serial.print(F("Battery: "));
      Serial.print(currentBatteryLevel);
      Serial.println(F("V"));
    lastBatteryLevel = currentBatteryLevel;
  }

  if (currentPosition != lastPosition) {
    if (mip.isOnBack()) {
      Serial.println(F("Position: On Back"));
    }
    if (mip.isFaceDown()) {
      Serial.println(F("Position: Face Down"));
    }
    if (mip.isUpright()) {
      Serial.println(F("Position: Upright"));
    }
    if (mip.isPickedUp()) {
      Serial.println(F("Position: Picked Up"));
    }
    if (mip.isHandStanding()) {
      Serial.println(F("Position: Hand Stand"));
    }
    if (mip.isFaceDownOnTray()) {
      Serial.println(F("Position: Face Down on Tray"));
    }
    if (mip.isOnBackWithKickstand()) {
      Serial.println(F("Position: On Back With Kickstand"));
    }

    lastPosition = currentPosition;
  }
}

isHandStanding()

bool isHandStanding()

Description

Is the MiP robot currently in a hand stand pose?

Parameters

None

Returns

  • true if the MiP robot is currently in a hand stand pose.
  • false otherwise.

Notes

  • The MiP robot status updates, which include the position, may be lost if you are spending too much time sending output back to the Arduino IDE's serial monitor. See Limitations section above.
  • These status updates are usually sent every 30 seconds or earlier if the MiP detects a change in position.

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("Status.ino - Display MiP status as it changes."));
}

void loop() {
  static float       lastBatteryLevel = 0.0f;
  static MiPPosition lastPosition = (MiPPosition) - 1;

  float              currentBatteryLevel = mip.readBatteryVoltage();
  MiPPosition        currentPosition = mip.readPosition();

  if (currentBatteryLevel != lastBatteryLevel) {
    Serial.print(F("Battery: "));
      Serial.print(currentBatteryLevel);
      Serial.println(F("V"));
    lastBatteryLevel = currentBatteryLevel;
  }

  if (currentPosition != lastPosition) {
    if (mip.isOnBack()) {
      Serial.println(F("Position: On Back"));
    }
    if (mip.isFaceDown()) {
      Serial.println(F("Position: Face Down"));
    }
    if (mip.isUpright()) {
      Serial.println(F("Position: Upright"));
    }
    if (mip.isPickedUp()) {
      Serial.println(F("Position: Picked Up"));
    }
    if (mip.isHandStanding()) {
      Serial.println(F("Position: Hand Stand"));
    }
    if (mip.isFaceDownOnTray()) {
      Serial.println(F("Position: Face Down on Tray"));
    }
    if (mip.isOnBackWithKickstand()) {
      Serial.println(F("Position: On Back With Kickstand"));
    }

    lastPosition = currentPosition;
  }
}

isFaceDownOnTray()

bool isFaceDownOnTray()

Description

Is the MiP robot currently face down on the tray?

Parameters

None

Returns

  • true if the MiP robot is currently face down on the tray.
  • false otherwise.

Notes

  • The MiP robot status updates, which include the position, may be lost if you are spending too much time sending output back to the Arduino IDE's serial monitor. See Limitations section above.
  • These status updates are usually sent every 30 seconds or earlier if the MiP detects a change in position.

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("Status.ino - Display MiP status as it changes."));
}

void loop() {
  static float       lastBatteryLevel = 0.0f;
  static MiPPosition lastPosition = (MiPPosition) - 1;

  float              currentBatteryLevel = mip.readBatteryVoltage();
  MiPPosition        currentPosition = mip.readPosition();

  if (currentBatteryLevel != lastBatteryLevel) {
    Serial.print(F("Battery: "));
      Serial.print(currentBatteryLevel);
      Serial.println(F("V"));
    lastBatteryLevel = currentBatteryLevel;
  }

  if (currentPosition != lastPosition) {
    if (mip.isOnBack()) {
      Serial.println(F("Position: On Back"));
    }
    if (mip.isFaceDown()) {
      Serial.println(F("Position: Face Down"));
    }
    if (mip.isUpright()) {
      Serial.println(F("Position: Upright"));
    }
    if (mip.isPickedUp()) {
      Serial.println(F("Position: Picked Up"));
    }
    if (mip.isHandStanding()) {
      Serial.println(F("Position: Hand Stand"));
    }
    if (mip.isFaceDownOnTray()) {
      Serial.println(F("Position: Face Down on Tray"));
    }
    if (mip.isOnBackWithKickstand()) {
      Serial.println(F("Position: On Back With Kickstand"));
    }

    lastPosition = currentPosition;
  }
}

isOnBackWithKickstand()

bool isOnBackWithKickstand()

Description

Is the MiP robot currently laying back on its kickstand?

Parameters

None

Returns

  • true if the MiP robot is currently laying back on its kickstand.
  • false otherwise.

Notes

  • The MiP robot status updates, which include the position, may be lost if you are spending too much time sending output back to the Arduino IDE's serial monitor. See Limitations section above.
  • These status updates are usually sent every 30 seconds or earlier if the MiP detects a change in position.

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("Status.ino - Display MiP status as it changes."));
}

void loop() {
  static float       lastBatteryLevel = 0.0f;
  static MiPPosition lastPosition = (MiPPosition) - 1;

  float              currentBatteryLevel = mip.readBatteryVoltage();
  MiPPosition        currentPosition = mip.readPosition();

  if (currentBatteryLevel != lastBatteryLevel) {
    Serial.print(F("Battery: "));
      Serial.print(currentBatteryLevel);
      Serial.println(F("V"));
    lastBatteryLevel = currentBatteryLevel;
  }

  if (currentPosition != lastPosition) {
    if (mip.isOnBack()) {
      Serial.println(F("Position: On Back"));
    }
    if (mip.isFaceDown()) {
      Serial.println(F("Position: Face Down"));
    }
    if (mip.isUpright()) {
      Serial.println(F("Position: Upright"));
    }
    if (mip.isPickedUp()) {
      Serial.println(F("Position: Picked Up"));
    }
    if (mip.isHandStanding()) {
      Serial.println(F("Position: Hand Stand"));
    }
    if (mip.isFaceDownOnTray()) {
      Serial.println(F("Position: Face Down on Tray"));
    }
    if (mip.isOnBackWithKickstand()) {
      Serial.println(F("Position: On Back With Kickstand"));
    }

    lastPosition = currentPosition;
  }
}

readWeight()

int8_t readWeight()

Description

Read the MiP robot's current estimate of how much weight it is carrying.

Parameters

None

Returns

A signed integer representing how much it is tilted to keep its center of mass directly over the wheels. A positive value if it is front heavy and a negative value if it is back heavy.

Notes

  • The MiP robot weight updates may be lost if you are spending too much time sending output back to the Arduino IDE's serial monitor. See Limitations section above.

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("Weight.ino - Use weight update functions."));
}

void loop() {
  static int8_t lastWeight = -128;
  int8_t currentWeight = mip.readWeight();

  if (currentWeight != lastWeight) {
    Serial.print(F("Weight = "));
      Serial.println(currentWeight);
    lastWeight = currentWeight;
  }
}

enableClapEvents()

void enableClapEvents()

Description

Enable the MiP robot to detect user claps. Once this is enabled, your code can call availableClapEvents() and readClapEvent to determine when clap events have been detected by the MiP.

Parameters

None

Returns

Nothing

Notes

  • The MiP robot defaults to having the clap detection feature disabled after the ProMini Pack attaches.

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("Clap.ino - Use clap related functions."));

  Serial.println(F("Calling disableClapEvents()"));
  mip.disableClapEvents();
  bool isEnabled = mip.areClapEventsEnabled();
  Serial.print(F("areClapEventsEnabled() returns "));
  if (isEnabled) {
    Serial.println(F("true - fail"));
  } else {
    Serial.println(F("false - pass"));
  }

  Serial.println(F("Calling writeClapDelay(501)"));
  mip.writeClapDelay(501);
  uint16_t delay = mip.readClapDelay();
  Serial.print(F("readClapDelay() returns "));
  Serial.println(delay);

  Serial.println(F("Calling enableClapEvents()"));
  mip.enableClapEvents();
  isEnabled = mip.areClapEventsEnabled();
  Serial.print(F("areClapEventsEnabled() returns "));
  if (isEnabled) {
    Serial.println(F("true - pass"));
  } else {
    Serial.println(F("false - fail"));
  }

  Serial.println();
  Serial.println(F("Waiting for clap events!"));
}

void loop() {
  while (mip.availableClapEvents() > 0) {
    uint8_t clapCount = mip.readClapEvent();
    Serial.print(F("Detected "));
      Serial.print(clapCount);
      Serial.println(F(" claps"));
  }
}

disableClapEvents()

void disableClapEvents()

Description

Disables the MiP robot's ability to detect user claps.

Parameters

None

Returns

Nothing

Notes

  • The MiP robot defaults to having the clap detection feature disabled after the ProMini Pack attaches.

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("Clap.ino - Use clap related functions."));

  Serial.println(F("Calling disableClapEvents()"));
  mip.disableClapEvents();
  bool isEnabled = mip.areClapEventsEnabled();
  Serial.print(F("areClapEventsEnabled() returns "));
  if (isEnabled) {
    Serial.println(F("true - fail"));
  } else {
    Serial.println(F("false - pass"));
  }

  Serial.println(F("Calling writeClapDelay(501)"));
  mip.writeClapDelay(501);
  uint16_t delay = mip.readClapDelay();
  Serial.print(F("readClapDelay() returns "));
  Serial.println(delay);

  Serial.println(F("Calling enableClapEvents()"));
  mip.enableClapEvents();
  isEnabled = mip.areClapEventsEnabled();
  Serial.print(F("areClapEventsEnabled() returns "));
  if (isEnabled) {
    Serial.println(F("true - pass"));
  } else {
    Serial.println(F("false - fail"));
  }

  Serial.println();
  Serial.println(F("Waiting for clap events!"));
}

void loop() {
  while (mip.availableClapEvents() > 0) {
    uint8_t clapCount = mip.readClapEvent();
    Serial.print(F("Detected "));
      Serial.print(clapCount);
      Serial.println(F(" claps"));
  }
}

areClapEventsEnabled()

bool areClapEventsEnabled()

Description

Returns whether the MiP robot's clap detection feature is currently enabled.

Parameters

None

Returns

  • true if the MiP robot was successfully placed in clap detection mode with a previous call to enableClapEvents().
  • false if it is not in clap detection mode.

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("Clap.ino - Use clap related functions."));

  Serial.println(F("Calling disableClapEvents()"));
  mip.disableClapEvents();
  bool isEnabled = mip.areClapEventsEnabled();
  Serial.print(F("areClapEventsEnabled() returns "));
  if (isEnabled) {
    Serial.println(F("true - fail"));
  } else {
    Serial.println(F("false - pass"));
  }

  Serial.println(F("Calling writeClapDelay(501)"));
  mip.writeClapDelay(501);
  uint16_t delay = mip.readClapDelay();
  Serial.print(F("readClapDelay() returns "));
  Serial.println(delay);

  Serial.println(F("Calling enableClapEvents()"));
  mip.enableClapEvents();
  isEnabled = mip.areClapEventsEnabled();
  Serial.print(F("areClapEventsEnabled() returns "));
  if (isEnabled) {
    Serial.println(F("true - pass"));
  } else {
    Serial.println(F("false - fail"));
  }

  Serial.println();
  Serial.println(F("Waiting for clap events!"));
}

void loop() {
  while (mip.availableClapEvents() > 0) {
    uint8_t clapCount = mip.readClapEvent();
    Serial.print(F("Detected "));
      Serial.print(clapCount);
      Serial.println(F(" claps"));
  }
}

writeClapDelay()

void writeClapDelay(uint16_t delay)

Description

Sets the expected delay between user claps.

Parameters

  • delay is the new delay to be used for clap detection.

Returns

Nothing

Notes

  • I don't know what the units are for this setting. Maybe milliseconds?
  • The MiP defaults to having the clap delay set to 500 after the application first connects.

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("Clap.ino - Use clap related functions."));

  Serial.println(F("Calling disableClapEvents()"));
  mip.disableClapEvents();
  bool isEnabled = mip.areClapEventsEnabled();
  Serial.print(F("areClapEventsEnabled() returns "));
  if (isEnabled) {
    Serial.println(F("true - fail"));
  } else {
    Serial.println(F("false - pass"));
  }

  Serial.println(F("Calling writeClapDelay(501)"));
  mip.writeClapDelay(501);
  uint16_t delay = mip.readClapDelay();
  Serial.print(F("readClapDelay() returns "));
  Serial.println(delay);

  Serial.println(F("Calling enableClapEvents()"));
  mip.enableClapEvents();
  isEnabled = mip.areClapEventsEnabled();
  Serial.print(F("areClapEventsEnabled() returns "));
  if (isEnabled) {
    Serial.println(F("true - pass"));
  } else {
    Serial.println(F("false - fail"));
  }

  Serial.println();
  Serial.println(F("Waiting for clap events!"));
}

void loop() {
  while (mip.availableClapEvents() > 0) {
    uint8_t clapCount = mip.readClapEvent();
    Serial.print(F("Detected "));
      Serial.print(clapCount);
      Serial.println(F(" claps"));
  }
}

readClapDelay()

uint16_t readClapDelay()

Description

Read the MiP robot's current clap delay.

Parameters

None

Returns

The current setting of the delay expected between claps. It defaults to 500.

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("Clap.ino - Use clap related functions."));

  Serial.println(F("Calling disableClapEvents()"));
  mip.disableClapEvents();
  bool isEnabled = mip.areClapEventsEnabled();
  Serial.print(F("areClapEventsEnabled() returns "));
  if (isEnabled) {
    Serial.println(F("true - fail"));
  } else {
    Serial.println(F("false - pass"));
  }

  Serial.println(F("Calling writeClapDelay(501)"));
  mip.writeClapDelay(501);
  uint16_t delay = mip.readClapDelay();
  Serial.print(F("readClapDelay() returns "));
  Serial.println(delay);

  Serial.println(F("Calling enableClapEvents()"));
  mip.enableClapEvents();
  isEnabled = mip.areClapEventsEnabled();
  Serial.print(F("areClapEventsEnabled() returns "));
  if (isEnabled) {
    Serial.println(F("true - pass"));
  } else {
    Serial.println(F("false - fail"));
  }

  Serial.println();
  Serial.println(F("Waiting for clap events!"));
}

void loop() {
  while (mip.availableClapEvents() > 0) {
    uint8_t clapCount = mip.readClapEvent();
    Serial.print(F("Detected "));
      Serial.print(clapCount);
      Serial.println(F(" claps"));
  }
}

availableClapEvents()

uint8_t availableClapEvents()

Description

Returns the number of clap detection events that the library currently has sitting in its queue, ready to be read by calling readClapEvent(). The MiP robot must have already been placed in clap detection mode via a call to enableClapEvents() for new clap detection events to be added to this queue.

Parameters

None

Returns

  • 0 if there are currently no clap detection events ready for reading. Calling readClapEvent() now would retun 0.
  • Non-zero value indicates the number of readClapEvent() calls that can be made and successfully return a valid clap detection event.

Notes

  • The maximum number of clap detection events that can be queued up between calls to readClapEvent() is 8. If this count is exceeded, the oldest events will be overwritten.

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("Clap.ino - Use clap related functions."));

  Serial.println(F("Calling disableClapEvents()"));
  mip.disableClapEvents();
  bool isEnabled = mip.areClapEventsEnabled();
  Serial.print(F("areClapEventsEnabled() returns "));
  if (isEnabled) {
    Serial.println(F("true - fail"));
  } else {
    Serial.println(F("false - pass"));
  }

  Serial.println(F("Calling writeClapDelay(501)"));
  mip.writeClapDelay(501);
  uint16_t delay = mip.readClapDelay();
  Serial.print(F("readClapDelay() returns "));
  Serial.println(delay);

  Serial.println(F("Calling enableClapEvents()"));
  mip.enableClapEvents();
  isEnabled = mip.areClapEventsEnabled();
  Serial.print(F("areClapEventsEnabled() returns "));
  if (isEnabled) {
    Serial.println(F("true - pass"));
  } else {
    Serial.println(F("false - fail"));
  }

  Serial.println();
  Serial.println(F("Waiting for clap events!"));
}

void loop() {
  while (mip.availableClapEvents() > 0) {
    uint8_t clapCount = mip.readClapEvent();
    Serial.print(F("Detected "));
      Serial.print(clapCount);
      Serial.println(F(" claps"));
  }
}

readClapEvent()

uint8_t readClapEvent()

Description

Returns a clap detection event from the library's queue. They will be returned in the order that the MiP robot detected them. The MiP robot must have already been placed in clap detection mode via a call to enableClapEvents() for new clap detection events to be added to this queue.

Parameters

None

Returns

  • 0 if the clap detection event queue is empty. availableClapEvents() would return 0 in this scenario.
  • The number of claps detected in this event (ie. 2 for a double clap).

Notes

  • The maximum number of clap detection events that can be queued up between calls to readClapEvent() is 8. If this count is exceeded, the oldest events will be overwritten.

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("Clap.ino - Use clap related functions."));

  Serial.println(F("Calling disableClapEvents()"));
  mip.disableClapEvents();
  bool isEnabled = mip.areClapEventsEnabled();
  Serial.print(F("areClapEventsEnabled() returns "));
  if (isEnabled) {
    Serial.println(F("true - fail"));
  } else {
    Serial.println(F("false - pass"));
  }

  Serial.println(F("Calling writeClapDelay(501)"));
  mip.writeClapDelay(501);
  uint16_t delay = mip.readClapDelay();
  Serial.print(F("readClapDelay() returns "));
  Serial.println(delay);

  Serial.println(F("Calling enableClapEvents()"));
  mip.enableClapEvents();
  isEnabled = mip.areClapEventsEnabled();
  Serial.print(F("areClapEventsEnabled() returns "));
  if (isEnabled) {
    Serial.println(F("true - pass"));
  } else {
    Serial.println(F("false - fail"));
  }

  Serial.println();
  Serial.println(F("Waiting for clap events!"));
}

void loop() {
  while (mip.availableClapEvents() > 0) {
    uint8_t clapCount = mip.readClapEvent();
    Serial.print(F("Detected "));
      Serial.print(clapCount);
      Serial.println(F(" claps"));
  }
}

hasBeenShaken()

bool hasBeenShaken()

Description

Returns whether the MiP robot has been shaken since the previous call.

Parameters

None

Returns

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

Example

#include <mip.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!"));
  }
}

readSoftwareVersion()

void readSoftwareVersion(MiPSoftwareVersion& software)

Description

Get the version information for the software in the MiP robot.

Parameters

  • software is a MiPSoftwareVersion object to be filled in with the version information of the MiP robot software.
class MiPSoftwareVersion
{
public:
    // ...
    uint16_t year;
    uint8_t  month;
    uint8_t  day;
    uint8_t  uniqueVersion;
};

Returns

Nothing

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("SoftwareHardwareVersion.ino - Use readSoftwareVersion() & readHardwareInfo() functions."));

  MiPSoftwareVersion softwareVersion;
  mip.readSoftwareVersion(softwareVersion);
  Serial.print(F("software version: "));
  Serial.print(softwareVersion.year);
    Serial.print('-');
    Serial.print(softwareVersion.month);
    Serial.print('-');
    Serial.print(softwareVersion.day);
    Serial.print('.');
    Serial.println(softwareVersion.uniqueVersion);

  MiPHardwareInfo hardwareInfo;
  mip.readHardwareInfo(hardwareInfo);
  Serial.println(F("hardware info"));
  Serial.print(F("  voice chip version: "));
    Serial.println(hardwareInfo.voiceChip);
  Serial.print(F("  hardware version: "));
    Serial.println(hardwareInfo.hardware);

  Serial.println();
  Serial.println(F("Sample done."));
}

void loop() {
}

readHardwareInfo()

void readHardwareInfo(MiPHardwareInfo& hardware)

Description

Get the version information for the hardware in the MiP robot.

Parameters

  • hardware is a MiPHardwareInfo object to be filled in with the version information of the MiP robot's hardware.
class MiPHardwareInfo
{
public:
    // ...
    uint8_t voiceChip;
    uint8_t hardware;
};

Returns

Nothing

Example

#include <mip.h>

MiP     mip;

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

  Serial.println(F("SoftwareHardwareVersion.ino - Use readSoftwareVersion() & readHardwareInfo() functions."));

  MiPSoftwareVersion softwareVersion;
  mip.readSoftwareVersion(softwareVersion);
  Serial.print(F("software version: "));
  Serial.print(softwareVersion.year);
    Serial.print('-');
    Serial.print(softwareVersion.month);
    Serial.print('-');
    Serial.print(softwareVersion.day);
    Serial.print('.');
    Serial.println(softwareVersion.uniqueVersion);

  MiPHardwareInfo hardwareInfo;
  mip.readHardwareInfo(hardwareInfo);
  Serial.println(F("hardware info"));
  Serial.print(F("  voice chip version: "));
    Serial.println(hardwareInfo.voiceChip);
  Serial.print(F("  hardware version: "));
    Serial.println(hardwareInfo.hardware);

  Serial.println();
  Serial.println(F("Sample done."));
}

void loop() {
}

enableAppMode()

void enableAppMode()

Description

Place MiP in app mode. The chest LED will turn green. App mode allows the MiP to interface with applications running on either the UART port or via Bluetooth.

Parameters

None

Returns

Nothing

Example

#include <mip.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);
}

enableCageMode()

void enableCageMode()

Description

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.

Parameters

None

Returns

Nothing

Example

#include <mip.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);
}

enableDanceMode()

void enableDanceMode()

Description

Place MiP in dance mode. The chest LED will turn turquoise and MiP will dance around and play music.

Parameters

None

Returns

Nothing

Example

#include <mip.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);
}

enableStackMode()

void enableStackMode()

Description

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.

Parameters

None

Returns

Nothing

Example

#include <mip.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);
}

enableTrickMode()

void enableTrickMode()

Description

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.

Parameters

None

Returns

Nothing

Example

#include <mip.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);
}

enableRoamMode()

void enableRoamMode()

Description

Place MiP in roam mode. The chest LED will turn yellow and roam freely, avoiding obstacles detected by the IR sensors.

Parameters

None

Returns

Nothing

Example

#include <mip.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);
}

isAppModeEnabled()

bool isAppModeEnabled()

Description

Returns whether the MiP is in app mode.

Parameters

None

Returns

  • true if the MiP robot was successfully placed in app mode with a previous call to enableAppMode().
  • false if it is not in app mode.

Example

#include <mip.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);
}

isCageModeEnabled()

bool isCageModeEnabled()

Description

Returns whether the MiP is in cage mode.

Parameters

None

Returns

  • true if the MiP robot was successfully placed in cage mode with a previous call to enableCageMode().
  • false if it is not in cage mode.

Example

#include <mip.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);
}

isDanceModeEnabled()

bool isDanceModeEnabled()

Description

Returns whether the MiP is in dance mode.

Parameters

None

Returns

  • true if the MiP robot was successfully placed in dance mode with a previous call to enableDanceMode().
  • false if it is not in dance mode.

Example

#include <mip.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);
}

isStackModeEnabled()

bool isStackModeEnabled()

Description

Returns whether the MiP is in stack mode.

Parameters

None

Returns

  • true if the MiP robot was successfully placed in stack mode with a previous call to enableStackMode().
  • false if it is not in stack mode.

Example

#include <mip.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);
}

isTrickModeEnabled()

bool isTrickModeEnabled()

Description

Returns whether the MiP is in trick mode.

Parameters

None

Returns

  • true if the MiP robot was successfully placed in trick mode with a previous call to enableTrickMode().
  • false if it is not in trick mode.

Example

#include <mip.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);
}

isRoamModeEnabled()

bool isRoamModeEnabled()

Description

Returns whether the MiP is in roam mode.

Parameters

None

Returns

  • true if the MiP robot was successfully placed in roam mode with a previous call to enableRoamMode().
  • false if it is not in roam mode.

Example

#include <mip.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);
}

setUserData()

void setUserData(uint8_t addressOffset, uint8_t userData)

Description

Stores one byte of user data to the offset specified. Valid offsets are 0x00-0x0F.

Parameters

  • addressOffset is the address offset at which to write the user's data.
  • userData is the one byte of data to be written to EEPROM.

Returns

Nothing

Example

#include <mip.h>

MiP           mip;

// Use an offset between 0x00 and 0x0F.
const uint8_t eepromAddressOffset = 0x00;

// Try different hex values here to see them stored and
// recovered from EEPROM.
uint8_t       secretPassword = 0x0D;

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("ReadWriteEeprom.ino - Writes data to EEPROM and reads it back."));

  Serial.print(F("Original password: "));
  Serial.println(secretPassword, HEX);

  // Power-off the MiP, comment out this line, recompile and load to the ProMini-Pack to see EEPROM
  // data preserved across power cycles.
  mip.setUserData(eepromAddressOffset, secretPassword);

  // "Scramble" the secret password.
  secretPassword = 0xFF;
  Serial.print(F("Scrambled password: "));
  Serial.println(secretPassword, HEX);

  Serial.print(F("Recovered password: "));
  Serial.print(mip.getUserData(eepromAddressOffset), HEX);
}

void loop() {
}

getUserData()

uint8_t getUserData(uint8_t addressOffset)

Description

Reads one byte of user data from the address offset specified. Valid addresses are 0x00-0x0F.

Parameters

  • addressOffset is the address at which to read stored data.

Returns

  • The contents of the EEPROM read from the given address offset.

Example

#include <mip.h>

MiP           mip;

// Use an offset between 0x00 and 0x0F.
const uint8_t eepromAddressOffset = 0x00;

// Try different hex values here to see them stored and
// recovered from EEPROM.
uint8_t       secretPassword = 0x0D;

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("ReadWriteEeprom.ino - Writes data to EEPROM and reads it back."));

  Serial.print(F("Original password: "));
  Serial.println(secretPassword, HEX);

  // Power-off the MiP, comment out this line, recompile and load to the ProMini-Pack to see EEPROM
  // data preserved across power cycles.
  mip.setUserData(eepromAddressOffset, secretPassword);

  // "Scramble" the secret password.
  secretPassword = 0xFF;
  Serial.print(F("Scrambled password: "));
  Serial.println(secretPassword, HEX);

  Serial.print(F("Recovered password: "));
  Serial.print(mip.getUserData(eepromAddressOffset), HEX);
}

void loop() {
}

enableMiPDetectionMode()

void enableMiPDetectionMode(uint8_t id, uint8_t txPower);

Description

Allows MiP to be discovered by another MiP using IR. MiP broadcasts a user-defined identification number for another MiP to read.

Parameters

  • id is the user-defined identification number to send to another MiP.

  • txPower is the IR transmission power. Valid values are 1 to 120 for about 1-300cm.

Returns

Nothing

Example

#include <mip.h>

MiP mip;

// Load this sketch on a pair of MiPs facing each other and use a different MIP_ID_NO for each.
#define MIP_ID_NO       0x10
#define MIP_IR_TX_POWER 0x78

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

  Serial.println(F("EnableMiPDetectionMode.ino - Enable your MiP to be discovered by another using IR."));

  if (!mip.isMiPDetectionModeEnabled())
    Serial.println(F("I am not discoverable."));

  mip.enableMiPDetectionMode(MIP_ID_NO, MIP_IR_TX_POWER);

  if (mip.isMiPDetectionModeEnabled())
    Serial.println(F("Now I can be discovered."));
}

void loop() {
  delay(3000);

  uint8_t detectedMiP = 0x00;

  // Spend about 10 seconds broadcasting MiP's ID while looking for another MiP.
  for (int i = 0; i < 3; i++) {
    if (mip.readDetectedMiP(detectedMiP)) {
      Serial.print(F("I detected MiP with ID number ")); Serial.println(detectedMiP, HEX);

    }
    delay(3333);
  }

  // MiP doesn't want to be found anymore.
  mip.disableMiPDetectionMode();

  // Verify it and keep looking for other MiPs.
  if (mip.isMiPDetectionModeEnabled())
    Serial.println(F("Now I can be discovered."));
  else
    Serial.println(F("I am not discoverable."));
  if (mip.readDetectedMiP(detectedMiP)) {
    Serial.print(F("I detected MiP with ID number ")); Serial.println(detectedMiP, HEX);
  }
}

disableMiPDetectionMode()

void disableMiPDetectionMode();

Description

Prevents MiP from being discovered by another MiP using IR.

Parameters

None

Returns

Nothing

Example

#include <mip.h>

MiP mip;

// Load this sketch on a pair of MiPs facing each other and use a different MIP_ID_NO for each.
#define MIP_ID_NO       0x10
#define MIP_IR_TX_POWER 0x78

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

  Serial.println(F("EnableMiPDetectionMode.ino - Enable your MiP to be discovered by another using IR."));

  if (!mip.isMiPDetectionModeEnabled())
    Serial.println(F("I am not discoverable."));

  mip.enableMiPDetectionMode(MIP_ID_NO, MIP_IR_TX_POWER);

  if (mip.isMiPDetectionModeEnabled())
    Serial.println(F("Now I can be discovered."));
}

void loop() {
  delay(3000);

  uint8_t detectedMiP = 0x00;

  // Spend about 10 seconds broadcasting MiP's ID while looking for another MiP.
  for (int i = 0; i < 3; i++) {
    if (mip.readDetectedMiP(detectedMiP)) {
      Serial.print(F("I detected MiP with ID number ")); Serial.println(detectedMiP, HEX);

    }
    delay(3333);
  }

  // MiP doesn't want to be found anymore.
  mip.disableMiPDetectionMode();

  // Verify it and keep looking for other MiPs.
  if (mip.isMiPDetectionModeEnabled())
    Serial.println(F("Now I can be discovered."));
  else
    Serial.println(F("I am not discoverable."));
  if (mip.readDetectedMiP(detectedMiP)) {
    Serial.print(F("I detected MiP with ID number ")); Serial.println(detectedMiP, HEX);
  }
}

isMiPDetectionModeEnabled()

bool isMiPDetectionModeEnabled()

Description

Checks whether MiP is broadcasting an identification number using IR.

Parameters

None

Returns

  • true if MiP is broadcasting its identification number.

Example

#include <mip.h>

MiP mip;

// Load this sketch on a pair of MiPs facing each other and use a different MIP_ID_NO for each.
#define MIP_ID_NO       0x10
#define MIP_IR_TX_POWER 0x78

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

  Serial.println(F("EnableMiPDetectionMode.ino - Enable your MiP to be discovered by another using IR."));

  if (!mip.isMiPDetectionModeEnabled())
    Serial.println(F("I am not discoverable."));

  mip.enableMiPDetectionMode(MIP_ID_NO, MIP_IR_TX_POWER);

  if (mip.isMiPDetectionModeEnabled())
    Serial.println(F("Now I can be discovered."));
}

void loop() {
  delay(3000);

  uint8_t detectedMiP = 0x00;

  // Spend about 10 seconds broadcasting MiP's ID while looking for another MiP.
  for (int i = 0; i < 3; i++) {
    if (mip.readDetectedMiP(detectedMiP)) {
      Serial.print(F("I detected MiP with ID number ")); Serial.println(detectedMiP, HEX);

    }
    delay(3333);
  }

  // MiP doesn't want to be found anymore.
  mip.disableMiPDetectionMode();

  // Verify it and keep looking for other MiPs.
  if (mip.isMiPDetectionModeEnabled())
    Serial.println(F("Now I can be discovered."));
  else
    Serial.println(F("I am not discoverable."));
  if (mip.readDetectedMiP(detectedMiP)) {
    Serial.print(F("I detected MiP with ID number ")); Serial.println(detectedMiP, HEX);
  }
}

readDetectedMiP()

int8_t readDetectedMiP(uint8_t& detectedMiP)

Description

Reads the identification number of a detected MiP.

Parameters

  • detectedMiP contains the identification number of a detected MiP after calling the function.

Returns

  • 0 if no MiP was detected.
  • 1 if a MiP was detected.

Example

#include <mip.h>

MiP mip;

// Load this sketch on a pair of MiPs facing each other and use a different MIP_ID_NO for each.
#define MIP_ID_NO       0x10
#define MIP_IR_TX_POWER 0x78

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

  Serial.println(F("EnableMiPDetectionMode.ino - Enable your MiP to be discovered by another using IR."));

  if (!mip.isMiPDetectionModeEnabled())
    Serial.println(F("I am not discoverable."));

  mip.enableMiPDetectionMode(MIP_ID_NO, MIP_IR_TX_POWER);

  if (mip.isMiPDetectionModeEnabled())
    Serial.println(F("Now I can be discovered."));
}

void loop() {
  delay(3000);

  uint8_t detectedMiP = 0x00;

  // Spend about 10 seconds broadcasting MiP's ID while looking for another MiP.
  for (int i = 0; i < 3; i++) {
    if (mip.readDetectedMiP(detectedMiP)) {
      Serial.print(F("I detected MiP with ID number ")); Serial.println(detectedMiP, HEX);

    }
    delay(3333);
  }

  // MiP doesn't want to be found anymore.
  mip.disableMiPDetectionMode();

  // Verify it and keep looking for other MiPs.
  if (mip.isMiPDetectionModeEnabled())
    Serial.println(F("Now I can be discovered."));
  else
    Serial.println(F("I am not discoverable."));
  if (mip.readDetectedMiP(detectedMiP)) {
    Serial.print(F("I detected MiP with ID number ")); Serial.println(detectedMiP, HEX);
  }
}

sendIRDongleCode()

void sendIRDongleCode(uint8_t sendCode[], uint8_t dataNumbers, uint8_t transmitPower)

Description

Sends code to another MiP using IR. The code to send may be of two, three or four bytes in length.

For two-byte codes any value may be sent, i.e. { 0xNN, 0xNN }.

For three-byte codes the following formats are valid: { 0x00-0x03, 0xNN, 0xNN } or { 0xNN, 0xNN, 0xFF }.

For four-byte codes the following formats are valid: { 0xNN, 0xNN, 0xFF, 0xFF } or { 0x00-0x03, 0x00-0x03, !0xFF, !0xFF }.

Parameters

  • sendCode is a four-byte array containing code to send to another MiP. sendCode[3] is the most significant byte. In sends of two significant bytes, sendCode[2] and sendCode[3] are sent. In sends of three significant bytes, sendCode[1], sendCode[2] and sendCode[3] are sent.
  • dataNumbers is the number of bytes to send. Allowable values are 2, 3 or 4.
  • txPower is the IR transmission power. Valid values are 1 to 120 for about 1-300cm.

Returns

Nothing

Example

#include <mip.h>

// Try different values for VALID_DATA_BYTES (2, 3 or 4)
#define VALID_DATA_BYTES 4

// Try different values for transmission power (0x01 - 0x78)
#define MIP_IR_TX_POWER  0x78

#define MAX_DATA_BYTES 4

MiP  mip;
bool connectResult;

// Try different codes for dongleCode[].
const uint8_t dongleCode[4] = { 0xBB, 0x0AB, 0xFF, 0xFF };

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

  Serial.println(F("SendIRDongleCode.ino - Send code to another MiP using IR."));
}

void loop() {
  Serial.print(F("Sending "));
  for (int i = MAX_DATA_BYTES - VALID_DATA_BYTES; i < MAX_DATA_BYTES; i++) {
    Serial.print(dongleCode[i], HEX); Serial.print(F(" "));
  }
  Serial.println();

  mip.sendIRDongleCode(dongleCode, VALID_DATA_BYTES, MIP_IR_TX_POWER);

  delay(1000);
}

readIRDongleCode()

int8_t readIRDongleCode(MiPIRCode& codeEvent)

Description

Reads code sent by another MiP using IR.

Parameters

  • codeEvent is the MiPIRCode object containing the received code after a call to the function.

Returns

  • MIP_ERROR_NO_EVENT if no transmitted data was found.
  • 0 if the data was received.

Example

#include <mip.h>

MiP       mip;
uint8_t   dongleCode[4] = { 0xFF, 0xFF, 0xFF, 0xFF };
MiPIRCode receiveCode;
bool      connectResult;

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

  Serial.println(F("ReadIRDongleCode.ino - Receive code from another MiP using IR."));
}

void loop() {
  mip.readIRDongleCode(receiveCode);

  if (receiveCode.dataNumbers) {
    Serial.print(F("Receiving ")); Serial.print(receiveCode.dataNumbers); Serial.println(F(" data numbers."));
    for (int i = 0; i < receiveCode.dataNumbers ; i++)
    {
      Serial.print(receiveCode.code[i], HEX); Serial.print(F(" "));
    }
    Serial.println();
  }

  receiveCode.clear();

  delay(500);
}

Clone this wiki locally