/* deuxième essai avec une autre library pour l'afficheur 7 segment * https://github.com/bremme/arduino-tm1637 * SevenSegmentTM1637 de Bram Harmsen */ // ************************************************** // Définitions pour l'afficheur U7 segments à 4 chiffres #include "SevenSegmentTM1637.h" const byte PIN_CLK = 2; // define CLK pin (any digital pin) const byte PIN_DIO = 3; // define DIO pin (any digital pin) SevenSegmentTM1637 display(PIN_CLK, PIN_DIO); // *************************************************** // Définitions pour le clavier matrice #include const byte ROWS = 4; //quatre rangées const byte COLS = 4; //quatre colonnes char keys[ROWS][COLS] = { {'1','2','3','Z'}, {'4','5','6','F'}, {'7','8','9','Z'}, {'*','0','#','R'} }; /* Correspondances entres les broches identifiées sur le téléphone et les pins de l'arduino R1 : 7 C1 : 8 R2 : 6 C2 : 9 R3 : 5 C3 : 10 R4 : 4 C4 : 11 */ byte rowPins[ROWS] = { 7, 6, 5, 4}; // connecter les rangées à ces pins byte colPins[COLS] = { 8, 9, 10, 11}; // connecter les colonnes à ces pins Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); void setup() { Serial.begin(9600); // Initialiser l'afficheur à 4 chiffres display.begin(); // initializes the display display.setBacklight(100); // set the brightness to 100 % display.print("INIT"); // display INIT on the display delay(1000); // wait 1000 ms } void loop() { char key = keypad.getKey(); if (key){ display.print(key); Serial.println(key); delay(300); } else { display.clear(); } }