-
Notifications
You must be signed in to change notification settings - Fork 0
SetPushButtonColor()
Arnd edited this page Dec 11, 2020
·
2 revisions
This function will set the color to which the encoder is set when the pushbutton is pressed. The Red, Green and Blue values are set where 0 corresponds to full power on and 255 to off with corresponding PWM values in between. If the SetFade() is turned on then the light will fade to off after button press, otherwise it will remain at the set brightness level.
The default value for the pushbutton press is (255,0,0), or full brightness red color.
// 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.SetPushButtonColor(0,0,255); // turn on blue when button pressed
delay(10000); // wait for 10 seconds for presses
Encoder.SetPushButtonColor(255,0,0); // turn on default red push color
} // of method setup()
void loop(){
// code goes here //
} // of method loop()