int duty;
int pot;
int i;

void setup(){
  pinMode(3, OUTPUT);
}

void loop(){
    pot=analogRead(A0);
    i=map(pot, 0, 1023, 0, 255);
    analogWrite(3, i);
    delay(10);
    duty=map(pot, 0, 1023, 0, 9);
  switch(duty){
    case 0:
    spento();
    display(6,7,8,9,10,11,0);
    break;
    case 1:
    spento();
    display(10,11,0,0,0,0,0);
   break;
    case 2:
    spento();
    display(6,7,0,9,10,0,12);
    break;
    case 3:
    spento();
    display(6,0,0,9,10,11,12);
    break;
    case 4:
    spento();
    display(0,0,8,0,10,11,12);
    break;
    case 5:
    spento();
    display(6,0,8,9,0,11,12);
    break;
    case 6:
    spento();
    display(6,7,8,0,0,11,12);
    break;
    case 7:
    spento();
   display(0,0,0,9,10,11,0);
    break;


    case 8:
    spento();
    display(6,7,8,9,10,11,12);
    break;
    case 9:
    spento();
    display(0,0,8,9,10,11,12);
    break;
  }
}

void display(int a, int b, int c, int d, int e, int f, int g){
  digitalWrite(a, HIGH);
  digitalWrite(b, HIGH);
  digitalWrite(c, HIGH);
  digitalWrite(d, HIGH);
  digitalWrite(e, HIGH);
  digitalWrite(f, HIGH);
  digitalWrite(g, HIGH);
}

void spento(){
  for(int i=6; i<13; i++){
  digitalWrite(i, LOW);
  }
}