程序:
const int rgb[] = {11,12,13};
int oldPin=0;
int newPin=0;
void deng();
void steup()
{
for(int i;i<=2;i++)
{ pinMode(rgb,OUTPUT);}
pinMode(13,OUTPUT);
for(int j=2;j<=9;j++)
{
pinMode(j,OUTPUT);
}
}// put your setup code here, to run once:
void loop()
{
digitalWrite(13,HIGH);
int n0[8]={0,0,0,0,0,0,1,1};
int z=0;
for(int x=2;x<=9;x++)
{
digitalWrite(x,n0[z]);
z++;
if (z>=9)
z=0;
}
delay(1000);
deng();
delay(1000);
}
void deng()
{
while(1)
{
oldPin=newPin;
newPin++;
if (newPin == 3)
{newPin=0;}
digitalWrite(rgb[oldPin],HIGH);
delay(1000);
digitalWrite(rgb[newPin],HIGH);
delay(1000);
digitalWrite(rgb[oldPin],LOW);
}
}
这个是编译错误的原因,求教原因,不胜感激.
|