选取共阳极led通过数字串口实现
通过简单设置各串口状态,利用循环实现。
代码如下:
uint8_t i,j;
void setup()
{ // put your setup code here, to run once:
for(i=2;i<10;i++)
{
pinMode(i,OUTPUT);
digitalWrite(i,HIGH);
}
}
void loop()
{ // put your main code here, to run repeatedly:
for(j=2;j<10;j++)
{
digitalWrite(j,LOW);
delay(200);
digitalWrite(j,HIGH);
delay(200);
}
}
自学arduino中,总结经验