Yun Jin Yonggledel임동교
Published © GPL3+

Innovation Lab #3: RGB LED

A Bongilcheon High School Innovation Lab project in which an RGB LED slowly brightens up and darkens.

BeginnerShowcase (no instructions)10 minutes797
Innovation Lab #3: RGB LED

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
RGB Diffused Common Cathode
RGB Diffused Common Cathode
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

RGB LED

RGB LED

Code

RGB LED

Arduino
Three colors are slowly brighten up and slowly darken.
int red = 11;
int green = 10;
int blue = 9;

void setup() {
  pinMode(red, OUTPUT);
  pinMode(green, OUTPUT);
  pinMode(blue, OUTPUT);
}

void loop() {
  for(int i = 0; i < 256; i++) {
    analogWrite(red, i);
    delay(10);
  }
for(int i = 256; i > 0; i--) {
    analogWrite(red, i);
    delay(10);
  }
for(int i = 0; i < 256; i++) {
    analogWrite(green, i);
    delay(10);
  }
for(int i = 256; i > 0; i--) {
    analogWrite(green, i);
    delay(10);
  }
for(int i = 0; i < 256; i++) {
    analogWrite(blue, i);
    delay(10);
  }
for(int i = 256; i > 0; i--) {
    analogWrite(blue, i);
    delay(10);
  }
}

Credits

Yun Jin Yong
6 projects • 10 followers
Contact
gledel
100 projects • 116 followers
Looking back on my childhood, I was happy when I was making something and I was proud of myself. "Making is instinct!"
Contact
임동교
0 projects • 12 followers
Contact

Comments

Please log in or sign up to comment.