Skip to content
github-actions[bot] edited this page Aug 11, 2026 · 11 revisions

Class MiP

Table of Contents


Constructors & Destructors

MiP

Signature: MiP()

Summary: Constructs the core MiP orchestrator object and binds subsystem references.

Details:

Initializes internal flags and resets error tracking states.


~MiP

Signature: ~MiP()

Summary: Destructs the MiP orchestrator object and terminates connections.

Details:

Calls end() to restore defaults and close transport services.


Public Functions

begin

Signature: bool begin()

Summary: Initializes the core UART connection to MiP.

Details:

Attempts connection at both 115200 and 9600 baud rates with retries. Sets up debug output on Serial1 and prepares internal state.

Returns: true if successfully connected to MiP, false otherwise.


end

Signature: void end()

Summary: Cleans up the connection to MiP and shuts down network services.

Details:

Restores default volume, sends disconnect command to MiP, and ends Serial/WiFi/OTA services.


sleep

Signature: void sleep()

Summary: Puts MiP to sleep.

Details:

MiP will need to be physically reset before another begin() call.


isInitialized

Signature: bool isInitialized() const

Summary: Check whether the MiP library has completed initialization.

Details:

Returns true when the internal initialization flag (MIP_FLAG_INITIALIZED) is set, indicating that begin() completed successfully and the MiP instance is ready for use. Returns false if initialization failed or has not yet been performed.

This accessor does not modify object state and has no side effects. Consider calling this before invoking API methods that require an active connection to MiP.

Returns: true if the MiP instance is initialized and ready; false otherwise.


lastCallResult

Signature: int8_t lastCallResult() const

Summary: Retrieves the error code from the most recently executed MiP API function.

Details:

The library automatically attempts to handle communication errors by retrying read/write operations behind the scenes. If an operation ultimately fails to recover, this function provides the specific reason for the failure.

Returns: int8_t The error code generated by the last operation (e.g., MIP_ERROR_NONE, MIP_ERROR_TIMEOUT, MIP_ERROR_BAD_RESPONSE).


didLastCallFail

Signature: bool didLastCallFail() const

Summary: Checks if the most recently executed MiP API function encountered a critical error.

Details:

A quick convenience method to determine if a command was successful without needing to evaluate the specific error code.

Returns: true If the last operation failed (m_lastError is not MIP_ERROR_NONE).


printLastCallResult

Signature: void printLastCallResult()

Summary: Prints a human-readable description of the last error to the debug channel (Serial1).


getBaudRate

Signature: uint32_t getBaudRate() const

Summary: Returns the UART baud rate currently in use with MiP.

Details:

After a successful begin(), this reports either 115200 or 9600 depending on which rate the library negotiated with MiP. Returns 0 if the connection has not been established (or after end() / a failed begin()).

Useful for diagnostics and for sketches that need to know the link speed of the connected MiP hardware revision.

Returns: Baud rate in bits per second (115200, 9600, or 0).


Public Variables

MIP_ERROR_NONE

Signature: constexpr uint8_t MIP_ERROR_NONE

Summary: Operation succeeded.


MIP_ERROR_TIMEOUT

Signature: constexpr uint8_t MIP_ERROR_TIMEOUT

Summary: Timed out waiting for response from MiP.


MIP_ERROR_NO_EVENT

Signature: constexpr uint8_t MIP_ERROR_NO_EVENT

Summary: No event has arrived from MiP yet.


MIP_ERROR_BAD_RESPONSE

Signature: constexpr uint8_t MIP_ERROR_BAD_RESPONSE

Summary: Unexpected response received from MiP.


MIP_ERROR_MAX_RETRIES

Signature: constexpr uint8_t MIP_ERROR_MAX_RETRIES

Summary: Exceeded maximum retries communicating with MiP.


battery

Signature: MiP_Battery battery

Summary: Interface for battery voltage queries (see MPU_Battery.h).


chestLED

Signature: MiP_ChestLED chestLED

Details:

Interface for chest LED RGB/flash control (see MPU_ChestLED.h).


clap

Signature: MiP_Clap clap

Details:

Interface for clap detection and delay configuration (see MPU_Clap.h).


eeprom

Signature: MiP_EEPROM eeprom

Details:

Interface for reading/writing non-volatile EEPROM (see MPU_EEPROM.h).


gesture

Signature: MiP_Gesture gesture

Details:

Interface for gesture detection mode and events (see MPU_Gesture.h).


headLEDs

Signature: MiP_HeadLEDs headLEDs

Details:

Interface for controlling head/eye LED patterns (see MPU_HeadLEDs.h).


infrared

Signature: MiP_Infrared infrared

Details:

Interface for IR remote control and MiP detection (see MPU_Infrared.h).


mode

Signature: MiP_Mode mode

Summary: Interface for game and app mode selection (see MPU_Mode.h).


motion

Signature: MiP_Motion motion

Details:

Interface for drive, turn, and posture control (see MPU_Motion.h).


odometer

Signature: MiP_Odometer odometer

Details:

Interface for reading and resetting distance odometer (see MPU_Odometer.h).


position

Signature: MiP_Position position

Details:

Interface for position and orientation state checks (see MPU_Position.h).


radar

Signature: MiP_Radar radar

Summary: Interface for IR radar proximity tracking (see MPU_Radar.h).


serial

Signature: MiP_Serial serial

Details:

Interface for low-level UART transport and event parsing (see MPU_Serial.h).


shake

Signature: MiP_Shake shake

Summary: Interface for shake event detection (see MPU_Shake.h).


sound

Signature: MiP_Sound sound

Details:

Interface for sound effects and volume control (see MPU_Sound.h).


version

Signature: MiP_Version version

Details:

Interface for querying hardware/software versions (see MPU_Version.h).


weight

Signature: MiP_Weight weight

Details:

Interface for payload weight sensor queries (see MPU_Weight.h).


wifi

Signature: MiP_WiFi wifi

Details:

Interface for WiFi, OTA, and network management (see MPU_WiFi.h).


Clone this wiki locally