Last active
December 24, 2017 06:35
-
-
Save skynettw/e7724d5f22624044d7110dd45eba3e00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int LEDRpin = 3; | |
int LEDGpin = 5; | |
int LEDBpin = 6; | |
void turn(int r, int g, int b) { | |
analogWrite(LEDRpin, r); | |
analogWrite(LEDGpin, g); | |
analogWrite(LEDBpin, b); | |
} | |
void setup() { | |
pinMode(LEDRpin, OUTPUT); | |
pinMode(LEDGpin, OUTPUT); | |
pinMode(LEDBpin, OUTPUT); | |
turn(0, 0, 0); | |
} | |
void loop() { | |
for(int i=0; i<256; i++) | |
{ | |
turn(i, i, i); | |
delay(5); | |
} | |
for(int i=255; i>0; i--) { | |
turn(i, i, i); | |
delay(5); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment