int i;
int j;
const char num[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
const int seg[]={2,3,4,5,6,7,8,9};
void setup()
{
for(i=0;i<8;i++)
{
pinMode(seg[i],OUTPUT);
}
}
void loop()
{
for(j=0;j<10;j++) { output(num[j]); delay(1000); }
}
void output(byte data)
{
for(i=0;i<8;i++)
digitalWrite(seg[i],bitRead(~data,i));
}
沒有留言:
張貼留言