int led_pin[] = {3, 5, 6, 10};
int brightness[7][4] =
{
{250, 0, 0, 0},
{100, 250, 0, 0},
{50, 100, 250, 0},
{5, 50, 100, 250},
{0, 5, 50, 100},
{0, 0, 5, 50},
{0, 0, 0, 5},
};
void setup()
{
}
void loop()
{
for (int j = 0; j < 7; j++)
{
for (int i = 0; i < 4; i++)
{
analogWrite(led_pin[i], brightness[j][i]);
delay(100);
}
}
for (int j = 0; j < 7; j++)
{
for (int i = 0; i < 4; i++)
{
analogWrite(led_pin[i],brightness[j][3-i]);
delay(100);
}
}
}
沒有留言:
張貼留言