-
Notifications
You must be signed in to change notification settings - Fork 0
Chest LED
Tiogaplanet edited this page Jul 15, 2026
·
5 revisions
Take control of MiP's chest LED.
void writeChestLED(uint8_t red, uint8_t green, uint8_t blue)
void writeChestLED(uint8_t red, uint8_t green, uint8_t blue, uint16_t onTime, uint16_t offTime)
void writeChestLED(const MiPChestLED& chestLED)
Sets the color and flashing period of the RGB LED in MiP’s chest.
- red is the intensity of the red colour channel (0 - 255).
- green is the intensity of the green colour channel (0 - 255).
- blue is the intensity of the blue colour channel (0 - 255). MiP actually clears the lower 2 bits of the blue colour channel to treat it as a 6-bit value.
- onTime is the time in milliseconds that the LED should remain on with the specified colour. This parameter can be set to a value between 0 and 5100 milliseconds.
- offTime is the time in milliseconds that the LED should remain off before turning on again with the specified colour. This parameter can be set to a value between 0 and 5100 milliseconds.
- chestLED is an object which contains red, green, blue, onTime, and offTime fields for setting the LED colour and flashing period.
class MiPChestLED
{
// ...
uint16_t onTime;
uint16_t offTime;
uint8_t red;
uint8_t green;
uint8_t blue;
};Nothing
- MiP only supports a granularity of 20 milliseconds for the onTime and offTime parameters.
- The
void writeChestLED(uint8_t red, uint8_t green, uint8_t blue)version can only set the LED to a solid colour with no flashing.
#include <MPU_D1_mini.h>
MiP mip;
void setup() {
bool connectResult = mip.begin();
if (!connectResult) {
Serial1.println(F("ChestLED.ino: Failed connecting to MiP!"));
return;
}
Serial1.println(F("ChestLED.ino: Set Chest LED to different colors."));
Serial1.println(F(" Set chest LED to magenta, no time specified."));
uint8_t red = 0xff;
uint8_t green = 0x01;
uint8_t blue = 0xfe;
mip.writeChestLED(red, green, blue);
printCurrentChestLEDSetting();
delay(1000);
Serial1.println(F(" Set chest LED to blink red, on time: 990, off time: 989."));
red = 0xff;
green = 0x01;
blue = 0x05;
const uint16_t onTime = 990;
const uint16_t offTime = 989;
mip.writeChestLED(red, green, blue, onTime, offTime);
printCurrentChestLEDSetting();
delay(4000);
Serial1.println(F(" Set chest LED back to green, no time specified."));
MiPChestLED chestLED;
chestLED.red = 0x00;
chestLED.green = 0xff;
chestLED.blue = 0x00;
chestLED.onTime = 0;
chestLED.offTime = 0;
mip.writeChestLED(chestLED);
printCurrentChestLEDSetting();
delay(1000);
// Attempt to run through the same sequence of chest LED changes using the
// unverifiedWriteChestLED() functions which don't always get accepted by MiP.
Serial1.println(F(" Trying to set chest LED to magenta, no time specified."));
red = 0xff;
green = 0x01;
blue = 0xfe;
mip.unverifiedWriteChestLED(red, green, blue);
delay(1000);
Serial1.println(F(" Trying to set chest LED to blink red, no time specified."));
red = 0xff;
green = 0x01;
blue = 0x05;
mip.unverifiedWriteChestLED(red, green, blue, onTime, offTime);
delay(4000);
Serial1.println(F(" Trying to set chest LED back to green, no time specified."));
chestLED.red = 0x00;
chestLED.green = 0xff;
chestLED.blue = 0x00;
chestLED.onTime = 0;
chestLED.offTime = 0;
mip.unverifiedWriteChestLED(chestLED);
delay(1000);
Serial1.println();
Serial1.println(F("ChestLED.ino: Done."));
}
void loop() {
}
static void printCurrentChestLEDSetting() {
MiPChestLED chestLED;
mip.readChestLED(chestLED);
Serial1.println(F(" Current Chest LED Setting"));
Serial1.print(F(" red: "));
Serial1.println(chestLED.red);
Serial1.print(F(" green: "));
Serial1.println(chestLED.green);
Serial1.print(F(" blue: "));
Serial1.println(chestLED.blue);
Serial1.print(F(" on time: "));
Serial1.print(chestLED.onTime);
Serial1.println(F(" milliseconds"));
Serial1.print(F(" off time: "));
Serial1.print(chestLED.offTime);
Serial1.println(F(" milliseconds"));
Serial1.println();
}🔗 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