Skip to content

SetColor()

Arnd edited this page Dec 11, 2020 · 2 revisions

SetColor(RedValue, GreenValue, BlueValue);

This function will set the LED color to the given Red, Green and Blue values; where 0 equates to full power on and 255 to off with corresponding PWM values in between. This command will have no effect if SetLEDState() is turned off.


Example:

// Instantiate the class using all of the pins defined in constants     //
EncoderClass Encoder(ROTARY_PIN_1, ROTARY_PIN_2, PUSHBUTTON_PIN, RED_PIN, 
                     GREEN_PIN, BLUE_PIN);

void setup() {
  Serial.begin(115200);
  delay(1000);
  Encoder.SetColor(0,0,0); // turn all color full which should be white
  delay(2000);           // wait for 2 seconds
  Encoder.SetColor(255,0,0); // turn on red color
} // of method setup()
void loop(){
  // code goes here //
} // of method loop()