Itching to use my Arduino Nano I'd acquired a couple of months previously, I suggested an upgrade!
Fastening the lights to the jumper was the hardest bit.
// Dim an LED using a PWM pin
int PWMpin = 10; // LED in series with 470 ohm resistor on pin 10
void setup()
{
// no setup needed
}
void loop()
{
for (int i=0; i <= 255; i++){
analogWrite(PWMpin, i);
delay(15);
}
for (int i=0; i <= 3; i++){
analogWrite(PWMpin, 255);
delay(500);
analogWrite(PWMpin, 0);
delay(500);
}
for (int i=0; i <= 10; i++){
analogWrite(PWMpin, 255);
delay(100);
analogWrite(PWMpin, 0);
delay(100);
}
for (int i=0; i <= 255; i++){
analogWrite(PWMpin, 0-i);
delay(15);
}
}
No comments:
Post a Comment