int led_pin[] = {3, 5, 6, 10};
void setup() {
// put your setup code here, to run once:
}
void loop()
{
for (int i = 0; i < 4; i++)
{
for (int bt = 0; bt > 255; bt += 5)
{
analogWrite(led_pin[i], bt);
delay(50);
}
for (int bt = 255; bt > 0; bt -= 5)
{
analogWrite(led_pin[i], bt);
delay(50);
}
analogWrite(led_pin[i], 0);
}
for (int i = 2; i >0; i--)
{
for (int bt = 0; bt > 255; bt += 5)
{
analogWrite(led_pin[i], bt);
delay(50);
}
for (int bt = 255; bt > 0; bt -= 5)
{
analogWrite(led_pin[i], bt);
delay(50);
}
analogWrite(led_pin[i], 0);
}
}
沒有留言:
張貼留言