Skip to content

Instantly share code, notes, and snippets.

@ybakos
Forked from sledge-1/arduino_expo
Created January 26, 2017 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ybakos/c1a5a56aec985b863f4347342d0c797a to your computer and use it in GitHub Desktop.
Save ybakos/c1a5a56aec985b863f4347342d0c797a to your computer and use it in GitHub Desktop.
const int LED[] = {9,10,11};
void setPinAndBrightnessUp (){
for (double b = 2; b < 256; b = pow(b,1.15) ){
for (int a = 0; a < 2; a++){
analogWrite(LED[a],(int)b);
delay(20);
analogWrite(LED[a], 0);
delay(10);
}
}
}
void setPinAndBrightnessDown (){
for (int b = 255; b > 1; b-=5){
for (int a = 1; a >= 0; a--){
analogWrite(LED[a],b);
delay(20);
analogWrite(LED[a], 0);
delay(10);
}
}
}
void setup() {
pinMode( 9 , OUTPUT);
pinMode( 10 , OUTPUT);
pinMode( 11 , OUTPUT);
}
void loop() {
setPinAndBrightnessUp();
setPinAndBrightnessDown ();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment