void setup() {
// put your setup code here, to run once:
Serial.begin(19200);
Serial.println("7 segment LED test...");
//Setup once for pin 0~7 (pord D) to output mode
//DDRD = B1111111;
for ( byte i = 0; i < 7; i ++ ){
pinMode(i, OUTPUT);//Setup once for pin 0~7 to output mode
}
}
byte index = 0;
const byte LEDs[10] = {
B0000001, //0
B1001111, //1
B0010010, //2
B0000110, //3
B1001100, //4
B0100100, //5
B0100000, //6
B0001111, //7
B0000000, //8
B0000100 //9
};
void loop() {
// put your main code here, to run repeatedly:
PORTD = LEDs[index];
//digitalWrite(3, HIGH);
index++;
Serial.println( LEDs[index] );
if ( index == 10 ){
index = 0;
}
delay(1000);
}