int led_pin[] = {3, 5, 6, 9};
int i;
void setup()
{
}
void loop()
{
for (int j = 0; j < 4; j++)
{
for ( i = 0; i < 255; i += 5)
{
analogWrite(led_pin[j], i); delay(30);
}
for (i = 255; i > 0; i -= 5)
{
analogWrite(led_pin[j], i); delay(30);
}
analogWrite(led_pin[j],i); delay(30);
delay(100);
}
for (int j = 2; j >0; j--)
{
for ( i = 0; i < 255; i += 5)
{
analogWrite(led_pin[j], i); delay(30);
}
for (i = 255; i > 0; i -= 5)
{
analogWrite(led_pin[j], i); delay(30);
}
analogWrite(led_pin[j],i); delay(30);
delay(100);
}
}
沒有留言:
張貼留言