Paso 11: Pruebas preliminares
Rápidamente escribí este código que va a contar de 0 a 9 con todos los dígitos, excepto para el primero de ellos por supuesto, que sólo se enciende cuando se muestra un '1'.
Por favor disculpa mi código no comentada. Yo volver y comentar más adelante, pero debe ser bastante sencillo y fácil de leer.
Sin duda tienes un alambre corto, desconectado o algo que arreglar en este paso.
int [] columnas = {0,1,2,3,4,5,6,7,8,9,10,11,12}; void setup() para (int x = 0; x < 1000; x ++) {} para (int x = 0; x < 1000; x ++) {} para (int x = 0; x < 1000; x ++) {} para (int x = 0; x < 1000; x ++) {} } void allOn() {} void allOff() {} void zero(int x) {}
int fila [] = {14,15,16,17,18};
{
para (int i = 0; i < 13; i ++) {}
pinMode(column[i],OUTPUT);
digitalWrite(column[i],LOW);
}
para (int j = 0; j < 5; j ++) {}
pinMode(row[j],OUTPUT);
digitalWrite(row[j],HIGH);
}
}
void loop () {}
Zero(0);
Zero(3);
Zero(6);
}
One(-3);
One(0);
One(3);
One(6);
}
para (int x = 0; x < 1000; x ++) {}
Two(0);
Two(3);
Two(6);
}
para (int x = 0; x < 1000; x ++) {}
Three(0);
tres (3);
Three(6);
}
para (int x = 0; x < 1000; x ++) {}
Four(0);
Four(3);
Four(6);
}
para (int x = 0; x < 1000; x ++) {}
Five(0);
Five(3);
Five(6);
}
para (int x = 0; x < 1000; x ++) {}
Six(0);
Six(3);
Six(6);
}
para (int x = 0; x < 1000; x ++) {}
Seven(0);
Seven(3);
Seven(6);
}
Eight(0);
Eight(3);
Eight(6);
}
Nine(0);
Nine(3);
Nine(6);
}
para (int x = 0; x < 5; x ++) {}
para (int y = 0; y < 13; y ++) {}
digitalWrite(row[x],LOW);
digitalWrite(column[y],HIGH);
}
}
}
para (int x = 0; x < 5; x ++) {}
para (int y = 0; y < 13; y ++) {}
digitalWrite(row[x],HIGH);
digitalWrite(column[y],LOW);
}
}
}
digitalWrite(column[1+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[1],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[1],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[3],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[3],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[3],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[3],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[1],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[1],HIGH);
}
void one(int x) {}
digitalWrite(column[3+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[1],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[1],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[3],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[3],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[4],HIGH);
}
void two(int x) {}
digitalWrite(column[1+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[3],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[3],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[1],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[1],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[0],HIGH);
}
void three(int x) {}
digitalWrite(column[1+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[3],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[3],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[1],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[1],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[0],HIGH);
}
void four(int x) {}
digitalWrite(column[3+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[1],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[1],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[3],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[3],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[3],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[3],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[4],HIGH);
}
void five(int x) {}
digitalWrite(column[1+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[3],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[3],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[1],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[1],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[0],HIGH);
}
void six(int x) {}
digitalWrite(column[1+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[3],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[3],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[1],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[1],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[1],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[1],HIGH);
}
void seven(int x) {}
digitalWrite(column[3+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[1],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[1],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[3],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[3],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[4],HIGH);
}
void eight(int x) {}
digitalWrite(column[1+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[1],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[1],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[3],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[3],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[3],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[3],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[1],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[1],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[2],HIGH);
}
void nine(int x) {}
digitalWrite(column[3+x],HIGH);
digitalWrite(row[0],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[0],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[1],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[1],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[3],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[3],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[1+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[1+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[2],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[2],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[3],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[3],HIGH);
digitalWrite(column[2+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[2+x],LOW);
digitalWrite(row[4],HIGH);
digitalWrite(column[3+x],HIGH);
digitalWrite(row[4],LOW);
digitalWrite(column[3+x],LOW);
digitalWrite(row[4],HIGH);
}