boas preciso de ajuda com este código e que estame a dar erros e eu não consigo descobrir como fazer para eles não aparecerem.
o código e este
#include "Keypad.h"
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}};
byte rowPins[ROWS] = {
5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {
8, 7, 6}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
char PIN[6]={'1','2','3','4','5','6'}; // su numero secreto (!)
char attempt[6]={0,0,0,0,0,0}; // usado para comparar
int z=0;
int led13= 13;
int sal1 = 10; // salida1, pin A4
int sal2 = 11; // salida2, pin A5
void setup()
{
pinMode(sal1, OUTPUT);
pinMode(sal2, OUTPUT);
Serial.begin(9600); //Configura la velocidad del puerto serie
keypad.setHoldTime(500); // Default is 1000mS
keypad.setDebounceTime(250); // Default is 50mS
Serial.println(" Debe introducir la secuencia: ");
Serial.print(" * X X X X X X # ");
Serial.println(" >> X = del 0 al 9");
incorrectPIN();
Serial.print(" ");
Serial.println(" Intentelo: ");
}
void correctPIN() // hacer esto. Si el PIN escrito es correcto
{
digitalWrite(10, LOW); // desactiva un contacto pin 1
digitalWrite(11, HIGH); // activa un contacto pin 2
Serial.print(" Correcto ");
Serial.print(attempt);
}
void incorrectPIN() // hacer esto. Si el PIN escrito es incorrecto
{
digitalWrite(11, LOW); // desactiva un contacto
digitalWrite(10, HIGH); // activa un contacto
Serial.print("Incorrecto ");
//Serial.print(" ");
}
void led()
{ if (led13 == LOW) led13= HIGH;
else { led13 = LOW;
}
}
void checkPIN()
{
int correct=0;
for (int q=0; q<=5; q++)
{
if (attempt[q]==PIN[q])
{
correct++;
}
}
if (correct==6)
{
correctPIN();
} else
{
incorrectPIN();
}
for (int zz=0; zz<6; zz++) // borrar tentativa
{
attempt[zz]=0;
}
}
void readKeypad()
{
char key = keypad.getKey();
if (key != NO_KEY)
{
switch(key)
{
case '*':
z=0; Serial.println(" ");
break;
case '#':
delay(50);
Serial.println(" ");
checkPIN();
break;
default:
attempt[z]=key;
z++;
}
Serial.print("*");
led();
}
}
void loop()
{
readKeypad();
}