Saltar la navegación

Control de un LED RGB por PWM

Control de un LED RGB por PWM

int red = 3;

int green = 6;

int blue = 5;

int interval=1000;

void setup() {

pinMode(red, OUTPUT);

pinMode(blue, OUTPUT);

pinMode(green, OUTPUT);

}

void loop() {

analogWrite(red, 210);

analogWrite(blue, 70);

analogWrite(green, 60);

delay(interval);

analogWrite(red, 100);

analogWrite(blue, 240);

analogWrite(green, 110);

delay(interval);

analogWrite(red, 255);

analogWrite(blue, 255);

analogWrite(green, 0);

delay(interval);

analogWrite(red, 255);

analogWrite(blue, 0);

analogWrite(green, 255);

delay(interval);

}