本帖最后由 嘿ME 于 2014-6-16 15:55 编辑
是用attachInterrupt(0,led,RISING)
用USB供电时都能正常的使用中断,
当我高兴的取下USB换成外接电源时却不能中断了,
这是什么情况?
BUG吗?
[mw_shl_code=c,true]const int tab[23][8]={
1,0,0,0,0,0,0,1,
1,1,1,1,1,1,1,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,
1,1,0,0,0,0,0,0,
//L
0,1,1,1,1,1,1,0,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,1,
0,1,1,1,1,1,1,0,
//O
0,0,0,0,0,0,0,1,
0,0,0,1,1,1,1,1,
1,1,1,0,0,0,0,0,
0,0,1,1,1,0,0,0,
0,0,0,0,0,1,1,1,
0,0,0,0,0,0,0,1,
//V
1,0,0,0,0,0,0,1,
1,1,1,1,1,1,1,1,
1,0,0,0,1,0,0,1,
1,0,0,1,1,1,0,1,
1,1,0,0,0,0,1,1
//E
};
void setup()
{
Serial.begin(9600);
pinMode(2,INPUT);
digitalWrite(2,LOW);
attachInterrupt(0,led,RISING);
for(int i=3;i<11;i++)
{
pinMode(i,OUTPUT);
}
}
void led()
{
for(int i=3;i<11;i++)
{
digitalWrite(i,LOW);
}
delay(5000);
}
void loop()
{
for(int x=0;x<23;x++)
{
for(int i=3;i<11;i++)
{
digitalWrite(i,tab[x-3]);
delay(1);
}
}
}[/mw_shl_code]
|