#define a   9
#define b   8
#define c   7
#define d   6
#define e   5
#define f   4
#define g   3
#define dp  2


void setup() {
  for(int i = 2; i <= 9; i++){
    pinMode(i, OUTPUT);
  }
}

void loop() {
  dispDigit(1,1,1,1,1,1,0,0);  //0
  delay(2000);
  dispDigit(0,1,1,0,0,0,0,0);  // 1
  delay(2000);
  dispDigit(1,1,0,1,1,0,1,0); // 2
  delay(2000);
  dispDigit(0,0,0,0,0,0,0,0);// clear
  delay(2000);
  dispDigit(1,1,1,0,1,1,1,0);// A
  delay(2000);
  dispDigit(0,0,1,1,1,1,1,0);// b
  delay(2000);
  dispDigit(1,0,0,1,1,1,0,0);// C
  delay(2000);
  dispDigit(0,1,1,1,1,0,1,0);// d
  delay(2000);
  dispDigit(1,0,0,1,1,1,1,0);// E
  delay(2000);
  dispDigit(1,0,0,0,1,1,1,0);// F
  delay(2000);
}

// Function to display digit ----
void dispDigit(int a1,int b1,int c1,int d1,int e1,int f1,int g1,int dp1){
  digitalWrite(a, a1);
  digitalWrite(b, b1);
  digitalWrite(c, c1);
  digitalWrite(d, d1);
  digitalWrite(e, e1);
  digitalWrite(f, f1);
  digitalWrite(g, g1);
  digitalWrite(dp, dp1);
}