Skip to content

SetCCWTurnColor()

Arnd edited this page Dec 11, 2020 · 2 revisions

SetCCWTurnColor(RedValue, GreenValue, BlueValue);

This function will set the color to which the encoder is set when the encoder is turned counter-clockwise. 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 the encoder stops moving, otherwise it will remain at the set brightness level.

The default value for the clockwise turn is (0,255,0), or full brightness green color.


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.SetCCWTurnColor(255,0,0); // turn on red for Ccw turn
  delay(10000);                    // wait for 10 seconds for turns
  Encoder.SetCWTurnColor(0,0,255); // turn on default blue turn color
} // of method setup()
void loop(){
  // code goes here //
} // of method loop()