int led_pin[]={2,3,4,5,6,7,8,9};
char led_table[]={0x81,0x42,0x24,0x18,0x24,0x42,0x81,0x00,0x81,0xc3,0xe7,0xff,0xe7,0xc3,0x81,0x00};
void setup()
{
Serial.begin(9600);
for(int i=0;i<8;i++)
{
pinMode(led_pin[i],OUTPUT);
digitalWrite(led_pin[i],LOW);
}
}
void loop()
{
for(int j=0;j<16;j++)
{
out(led_table[j]);
Serial.println(j);
delay(500);
}
}
void out(byte data)
{
for(int k=0;k<8;k++)
{
if(data%2==0)digitalWrite(led_pin[k],LOW);
else digitalWrite(led_pin[k],HIGH);
data=data/2;
}
}
沒有留言:
張貼留言