Things used in this project

Hardware components:
102110017%206
MediaTek Labs LinkIt Smart 7688 Duo
×1
rgb led (genaric)
×1
266 04
Female/Female Jumper Wires
×1
Software apps and online services:
Ide web
Arduino IDE

Schematics

img_0048_nr6zK9GBCB.JPG
Img 0048 nr6zk9gbcb
img_0046_hRYAzBjSmj.JPG
Img 0046 hryazbjsmj
img_0051_8aJFlqYePt.JPG
Img 0051 8ajflqyept

Code

color fade codeArduino
const int r = 9;
const int g = 10;
const int b = 11;

int re = 0;
int ge = 255;
int be = 0;


void setup() {
  pinMode(r, OUTPUT);
  pinMode(g, OUTPUT);
  pinMode(b, OUTPUT);

  analogWrite(r, 0);
  analogWrite(g, 0);
  analogWrite(b, 255);

  while (re < 255) {
    re++;
    ge--;
    analogWrite(r, re);
    analogWrite(g, ge);
    analogWrite(b, be);
    delay(20);
  }

}

void loop() {
  
  while (ge < 255) {
    ge++;
    re--;
    analogWrite(r, re);
    analogWrite(g, ge);
    analogWrite(b, be);
    delay(20);
  }

  while (be < 255) {
    be++;
    ge--;
    analogWrite(r, re);
    analogWrite(g, ge);
    analogWrite(b, be);
    delay(20);
  }

  while (re < 255) {
    re++;
    be--;
    analogWrite(r, re);
    analogWrite(g, ge);
    analogWrite(b, be);
    delay(20);
  }

}

Credits

Arduinopi2 ofkefo1gyq
Grant
11 projects • 24 followers
DIY technology hobbyist
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Add projectSign up / Login