Olá, eu queria colocar a letra do teclado keypad e por um delay(500) para ele trocar por “*” mas não estou conseguindo, então mascarei direto mas preciso fazer da outra forma, como faço ?
#include <Keypad.h>
#include <LiquidCrystal.h>
const byte linhas = 4;
const byte colunas = 3;
const int rs = A0, en = A1, d4 = A5, d5 = A4, d6 = A3, d7 = A2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
char teclado[linhas][colunas] = {
{‘1’, ‘2’, ‘3’},
{‘4’, ‘5’, ‘6’},
{‘7’, ‘8’, ‘9’},
{’*’, ‘0’, ‘#’}
};
byte linhasPins[linhas] = {9, 8, 7, 6};
byte colunasPins[colunas] = {5, 4, 3};
int pos = 0;
int led = 2;
char senha[12];
char correta[] = “123456”;
byte currentLength = 0;
Keypad customKeypad = Keypad(makeKeymap(teclado), linhasPins, colunasPins, linhas, colunas);
void setup() {
pinMode(led, OUTPUT);
Serial.begin(9600);
lcd.begin(20, 4);
lcd.print(“Bem vindo!”);
delay(2000);
lcd.clear();
lcd.print(“Digite sua senha: “);
delay(2000);
lcd.clear();
}
void loop() {
char tecla = customKeypad.getKey();
if (tecla) {
lcd.cursor();
lcd.print(”**”);
if (tecla != NO_KEY) {
if (tecla != ‘#’ && tecla != ‘<em>’) {
senha[pos] = tecla;
pos++;
}
if (tecla == ‘#’ || tecla == '</em>’) {
lcd.clear();
if (!strcmp(correta, senha)) {
lcd.print(“Senha correta”);
digitalWrite(led, HIGH);
delay(3000);
lcd.clear();
} else {
lcd.clear();
lcd.print(“Senha Incorreta”);
digitalWrite(led, LOW);
delay(3000);
lcd.clear();
}
{
delay(500);
for (int i = 0; i < strlen(senha); i++) senha[i] = ’ ';
pos = 0;
digitalWrite(led, LOW);
}
}
}
}
}