void setup()
{
for(int i=0;i<=7;i++) //把0-7设置为输入
pinMode(i,INPUT);
for(int j=8;j<=13;j++) //把8-13设置为输出
pinMode(j,OUTPUT);
}
void loop()
{
if(digitalRead(1)==HIGH)
{
if(digitalRead(1)==HIGH)
{
for (int x=9; x<=12; x++) //循环方式依次让每个led在1秒内点亮
{
digitalWrite(x,HIGH);
delay(1000);
}
}
delay(10000);
for (int x=9; x<=12; x++) //循环方式依次让每个led熄灭
{
digitalWrite(x,LOW);
}
for (int K=1; K<=10; K++) //循环10次,亮0.5秒灭0.5秒,共10秒
{
digitalWrite(13,HIGH);
delay(500);
digitalWrite(13,LOW);
delay(500);
}
}
}