1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- //Load the default runtime for RGB Mode
- void loadRGBModeDefault() {
- values[0] = MAX_BRIGHTNESS; //R
- values[1] = MAX_BRIGHTNESS; //G
- values[2] = MAX_BRIGHTNESS; //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("}");
- }
|