/* * RGB Mode * * Allow user to adjust R/G/B channel * seperately * * */ //Load the default runtime for RGB Mode void loadRGBModeDefault() { values[0] = MAX_BRIGHTNESS/2; //R values[1] = MAX_BRIGHTNESS/2; //G values[2] = MAX_BRIGHTNESS/2; //B adjustingCatergory = 0; //Set current controlling to red setControlLEDColor(MAX_CTRLBRIGHTNESS, 0, 0); //Set LED color to white setLightColor(values[0], values[1], values[2]); } //Handlers for add / minus button void handleRGBModeAdd() { switch (adjustingCatergory) { case 0: //Red values[0] += 2; if (values[0] > 255) { values[0] = 255; blinkUpperLimit(); } break; case 1: //Green values[1] += 2; if (values[1] > 255) { values[1] = 255; blinkUpperLimit(); } break; case 2: //Blue values[2] += 2; if (values[2] > 255) { values[2] = 255; blinkUpperLimit(); } break; } //Update the LED color setLightColor(values[0], values[1], values[2]); Serial.print("Updating RGB value to {"); Serial.print(values[0]); Serial.print(", "); Serial.print(values[1]); Serial.print(", "); Serial.print(values[2]); Serial.println("}"); } void handleRGBModeMinus() { switch (adjustingCatergory) { case 0: //Red values[0] -= 2; if (values[0] <= 0) { values[0] = 0; blinkLowerLimit(); } break; case 1: //Green values[1] -= 2; if (values[1] <= 0) { values[1] = 0; blinkLowerLimit(); } break; case 2: //Blue values[2] -= 2; if (values[2] <= 0) { values[2] = 0; blinkLowerLimit(); } break; } //Update the LED color setLightColor(values[0], values[1], values[2]); Serial.print("Updating RGB value to {"); Serial.print(values[0]); Serial.print(", "); Serial.print(values[1]); Serial.print(", "); Serial.print(values[2]); Serial.println("}"); }