Back to Parent

Codes for the RGB LED
int redPin = D2;
int greenPin = D0;
int bluePin = D1;
 
void setup() {

  //declare LED RRB as output
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);

}

void setLED (int state){ //turn on/off the led light according to state

  digitalWrite(redPin, state);
  delay(3000);  // wait for 500 milliseconds

  digitalWrite(greenPin, state);
  delay(3000);  // wait for 500 milliseconds

  digitalWrite(bluePin, state);
  delay(3000);  // wait for 500 milliseconds

}
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0