int led_pin[]={3,5,6,9,10,11};
int i;
void setup()
{
int a;
for(a=0;a<6;a++)
{
pinMode(led_pin,OUTPUT);
}
}
//---------------------------------
void led3()
{
for(i=0;i<255;i++)
{
analogWrite(3,i);
delay(10);
}
for(i=255;i>=0;i--)
{
analogWrite(3,i);
delay(10);
}
}
//-----------------------------------
void led5()
{
for(i=0;i<255;i++)
{
analogWrite(5,i);
delay(10);
}
for(i=255;i>=0;i--)
{
analogWrite(5,i);
delay(10);
}
}
//-----------------------------------
void led6()
{
for(i=0;i<255;i++)
{
analogWrite(6,i);
delay(10);
}
for(i=255;i>=0;i--)
{
analogWrite(6,i);
delay(10);
}
}
//-----------------------------------
void led9()
{
for(i=0;i<255;i++)
{
analogWrite(9,i);
delay(10);
}
for(i=255;i>=0;i--)
{
analogWrite(9,i);
delay(10);
}
}
//----------------------
void led10()
{
for(i=0;i<255;i++)
{
analogWrite(10,i);
delay(10);
}
for(i=255;i>=0;i--)
{
analogWrite(10,i);
delay(10);
}
}
//-------------------------
void led11()
{
for(i=0;i<255;i++)
{
analogWrite(11,i);
delay(10);
}
for(i=255;i>=0;i--)
{
analogWrite(11,i);
delay(10);
}
}
void loop()
{
led3();
led5();
led6();
led9();
led10();
led11();
}
沒有留言:
張貼留言