#include <Keypad.h>
#include <SPI.h>
#include <DMD2.h>
#include <fonts/Arial_Black_16.h>
SoftDMD dmd(2,1);
DMD_TextBox box(dmd,6,1,64,16);
DMD_TextBox box_1(dmd,0,1,55,16);
const int ROW_NUM = 4; //four rows
const int COLUMN_NUM = 4; //four columns
char buf1[6];
int pos=0;
char keys[ROW_NUM][COLUMN_NUM] = {
{ '1','2', '3', ':' },
{ '4','5', '6', 'B' },
{ '7','8', '9', 'C' },
{ '*', '0', ':', 'D' }
};
byte pin_rows[ROW_NUM] = {A0,A1,A2,A3}; //connect to the row pinouts of the keypad
byte pin_column[COLUMN_NUM] = {A4,A5,2,3}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), pin_rows, pin_column, ROW_NUM, COLUMN_NUM );
void setup(){
dmd.setBrightness(52);//LUMINOSITE FIXEE A 20%
dmd.selectFont(Arial_Black_16);//CHOIX DE LA POLICE
dmd.begin();//
box.print("IN OUT");
delay(3000);
box.clear();
Serial.begin(9600);
Serial.println("ON EST DANS LE SETUP");
}
void loop(){
char key = keypad.getKey();
if(key) // On appuie sur une touche du clavier matriciel
{
buf1[pos] = key;
dmd.begin();
box_1.print(buf1);
Serial.println(buf1);
delay(1000);
pos++;
if(pos==5){buf1[pos]='\0'; pos=0; }
}
if(buf1[5]='\0'){ dmd.begin();
Serial.println(buf1);
box_1.print(buf1);
}
}