-
Notifications
You must be signed in to change notification settings - Fork 0
Initialization
Use these functions to initialize MiP.
MiP()
This MiP constructor is used to create an instance of a MiP object, whose name you need to provide as in the example below. Only one MiP object should be created in your sketch.
You still need to call begin() to initialize communication with MiP before calling any other MiP functions.
None
Nothing
// Include the MiP library so that you can use its functions.
#include <MPU_D1_mini.h>
// Setup new MiP object.
MiP mip;bool MiP::begin()
Initializes MiP to be controlled by the ESP8266 instead of Bluetooth Low Energy. The LED on MiP's chest will switch from blue to green once communication between the ESP8266 and MiP is established.
Calling another MiP function before begin() has successfully been called will typically generate an error message and your program will be halted so that you can diagnose and correct the problem.
isInitialized() can be called to determine if begin() has been successfully called or not.
None
- true if MiP was successfully initialized.
- false if begin() failed to properly initialize MiP.
// Include the MiP library so that you can use its functions.
#include <MPU_D1_mini.h>
// Setup new MiP object.
MiP mip;
void setup() {
// Call begin() to initialize the MiP robot.
// Returns false if it fails to initialize the MiP robot.
bool connectResult = mip.begin();
if (!connectResult) {
Serial1.println(F("Failed connecting to MiP!"));
return;
}
}void end()
Disconnects from MiP, disables serial communication, and allows the Serial Rx/Tx pins to be used for general input/output.
isInitialized() will return false after end() has been called.
None
Nothing
mip.end();void sleep()
Puts MiP to sleep. MiP will need to be shut off and back on to wake from sleep. Calling begin() will not wake it.
None
Nothing
Serial1.println(F("Putting MiP to sleep. Will require power cycle before it will accept UART connections again."));
mip.sleep();bool isInitialized()
Returns whether begin() has been called successfully yet or not.
None
-
true if MiP was successfully initialized.
- false if begin() failed to properly initialize MiP or end() has been called since the successful begin().
if (!mip.isInitialized()) {
// Handle the fact that the MiP robot hasn't been initialized yet.
}🔗 Quick Links: Main Repository • Report an Issue • Wiki Home
An open-source API for the WowWee MiP Robot. Licensed under Apache-2.0.
- MiP
- MiPChestLED
- MiPClapSettings
- MiPDebug
- MiPHardwareInfo
- MiPHeadLEDs
- MiPIRDongleCode
- MiPSoftwareVersion
- MiPStatus
- MiP_Battery
- MiP_ChestLED
- MiP_Clap
- MiP_EEPROM
- MiP_Gesture
- MiP_HeadLEDs
- MiP_Infrared
- MiP_Mode
- MiP_Motion
- MiP_Odometer
- MiP_Position
- MiP_Radar
- MiP_Serial
- MiP_Shake
- MiP_Sound
- MiP_Version
- MiP_Weight
- MiP_WiFi