quinta-feira, 9 de abril de 2015

Arduino UNO R3 - FADE



1)


2)

int led = 9;
int brightness = 0;
int fadeAmount = 5;
void setup()  {
pinMode(led, OUTPUT);
}
void loop()  {
analogWrite(led, brightness);
brightness = brightness + fadeAmount;
if (brightness == 0 || brightness == 255) {
fadeAmount = -fadeAmount ;
}
delay(30);
}