Paso 7: Los códigos
Configuración de las tarjetas, nombres de usuario y contraseñas.
// init paralle arraysbyte knownCards[NR_KNOWN_CARDS][CARD_SIZE] = { {0x93, 0x47, 0xe0, 0x00}, {0xe5, 0xa2, 0x9c, 0x2c} };char name[NR_KNOWN_CARDS][10] = { "James", "Richard" };char password[NR_KNOWN_CARDS][5] = { "1234", "8888" };
Configurar el teclado.
// define for keypad#include <Keypad.h>const byte ROWS = 4; const byte COLS = 4; //define the cymbols on the buttons of the keypads char hexaKeys[ROWS][COLS] = { {'1','2','3','A'}, {'4','5','6','B'}, {'7','8','9','C'}, {'*','0','#','D'} }; byte rowPins[ROWS] = {5, 4, 3, 2}; byte colPins[COLS] = {14, 15, 16, 17};
Configuración de la pantalla LCD.
// define for lcd#include <Wire.h>#include <LiquidCrystal_I2C.h>LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
El bucle de evento principal.
void loop() { init_lcd(); scan_new_card(); key_in_password();}