#include "LedControl.h"
/*
Now we need a LedControl to work with.
***** These pin numbers will probably not work with your hardware *****
pin 10 y 9 son de datain DataIn
pin 13 CLK
pin 11 LOAD
y el uno es porque son matrices individuales
*/
LedControl M1=LedControl(10,13,11,1);
LedControl M2=LedControl(9,13,11,1);
int count=0;
void setup() {
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
}
//byte "numero"[cantidad de columnas de la matriz]
byte uno[8]={
B00011000,
B00011100,
B00011000,
B00011000,
B00011000,
B00011000,
B00011000,
B00111100
};
byte dos[8]={
B01111110,
B11100011,
B11100011,
B01110000,
B00111000,
B00011100,
B00001110,
B11111111
};
byte tres[8]={
B00111100,
B01100010,
B01100000,
B00111000,
B01110000,
B01100010,
B01100110,
B00111100
};
byte cuatro[8]={
B00110000,
B01101000,
B01100100,
B01100010,
B01100001,
B11111111,
B01100000,
B01100000
};
byte cinco[8]={
B01111111,
B00000011,
B00000011,
B01111111,
B11100000,
B11000001,
B11100011,
B01111110
};
byte seis[8]{
B00111000,
B00011100,
B00001110,
B00011111,
B00110011,
B01100011,
B01100110,
B00111100
};
byte siete[8]{
B01111110,
B11111110,
B11000000,
B01100000,
B00110000,
B00011000,
B00001100,
B00000100
};
byte ocho[8]{
B00111100,
B01100110,
B01100110,
B00111100,
B01100110,
B01100110,
B01100110,
B00111100
};
byte nueve[8]{
B00111100,
B01000110,
B01000110,
B01111110,
B00111110,
B00000110,
B00000110,
B00000110
};
void loop() {
write_numbers(dos, M1);
write_numbers(ocho, M2);
}
//void para controlas las columnas de las matrices byte=numero, ledcontro matrix=matriz que queremos controlar
void write_numbers(byte x[], LedControl matrix) {
matrix.setRow(0,0,x[0]);
matrix.setRow(0,1,x[1]);
matrix.setRow(0,2,x[2]);
matrix.setRow(0,3,x[3]);
matrix.setRow(0,4,x[4]);
matrix.setRow(0,5,x[5]);
matrix.setRow(0,6,x[6]);
matrix.setRow(0,7,x[7]);
}