#define btn 16
int pines[]={19,21,17,5,18,22,23};
int del=100, n=0;

void setup() {
  pinMode(btn, INPUT);
  for(int p=0;p<7;p++){
    pinMode(pines[p], OUTPUT);
    }
}

void loop() {
  if(digitalRead(btn)){
    delay(del); while(digitalRead(btn)); //rebote
    n++;
    if(n>9){n=0;}
  }
  switch (n){
    case 0: cero(); break;
    case 1: uno(); break;
    case 2: dos(); break;
    case 3: tres(); break;
    case 4: cuatro(); break;
    case 5: cinco(); break;
    case 6: seis(); break;
    case 7: siete(); break;
    case 8: ocho(); break;
    case 9: nueve(); break;
    default: break;
  }
}
void uno(){
// uno 0110000
digitalWrite(pines[0], 0); //a19
digitalWrite(pines[1], 1); //b21
digitalWrite(pines[2], 1); //c17
digitalWrite(pines[3], 0); //d5
digitalWrite(pines[4], 0); //e18
digitalWrite(pines[5], 0); //f22
digitalWrite(pines[6], 0); //g23
}
void dos(){
// dos 1101101
digitalWrite(pines[0], 1);
digitalWrite(pines[1], 1);
digitalWrite(pines[2], 0);
digitalWrite(pines[3], 1);
digitalWrite(pines[4], 1);
digitalWrite(pines[5], 0);
digitalWrite(pines[6], 1);
}
void tres(){
// tres 1111001
digitalWrite(pines[0], 1);
digitalWrite(pines[1], 1);
digitalWrite(pines[2], 1);
digitalWrite(pines[3], 1);
digitalWrite(pines[4], 0);
digitalWrite(pines[5], 0);
digitalWrite(pines[6], 1);
}
void cuatro(){
// cuatro 0110011
digitalWrite(pines[0], 0);
digitalWrite(pines[1], 1);
digitalWrite(pines[2], 1);
digitalWrite(pines[3], 0);
digitalWrite(pines[4], 0);
digitalWrite(pines[5], 1);
digitalWrite(pines[6], 1);
}
void cinco(){
// cinco 1011011
digitalWrite(pines[0], 1);
digitalWrite(pines[1], 0);
digitalWrite(pines[2], 1);
digitalWrite(pines[3], 1);
digitalWrite(pines[4], 0);
digitalWrite(pines[5], 1);
digitalWrite(pines[6], 1);
}
void seis(){
// seis 1011111
digitalWrite(pines[0], 1);
digitalWrite(pines[1], 0);
digitalWrite(pines[2], 1);
digitalWrite(pines[3], 1);
digitalWrite(pines[4], 1);
digitalWrite(pines[5], 1);
digitalWrite(pines[6], 1);
}
void siete(){
// siete 1110000
digitalWrite(pines[0], 1);
digitalWrite(pines[1], 1);
digitalWrite(pines[2], 1);
digitalWrite(pines[3], 0);
digitalWrite(pines[4], 0);
digitalWrite(pines[5], 0);
digitalWrite(pines[6], 0);
}

void ocho(){
// ocho 11111111
digitalWrite(pines[0], 1);
digitalWrite(pines[1], 1);
digitalWrite(pines[2], 1);
digitalWrite(pines[3], 1);
digitalWrite(pines[4], 1);
digitalWrite(pines[5], 1);
digitalWrite(pines[6], 1);
}
void nueve(){
// nueve 1111011
digitalWrite(pines[0], 1);
digitalWrite(pines[1], 1);
digitalWrite(pines[2], 1);
digitalWrite(pines[3], 1);
digitalWrite(pines[4], 0);
digitalWrite(pines[5], 1);
digitalWrite(pines[6], 1);
}
void cero(){
// cero 1111110
digitalWrite(pines[0], 1);
digitalWrite(pines[1], 1);
digitalWrite(pines[2], 1);
digitalWrite(pines[3], 1);
digitalWrite(pines[4], 1);
digitalWrite(pines[5], 1);
digitalWrite(pines[6], 0);
}