# Problem on nfc and 4x4 button membrane.

NFC Module is working and 4x4 button is working.
But when I combine them, the NFC starts to read tags but 4x4 button do not respond or does not working to enter a value.
Is there any problem in my codes ?

Here:

sketch_sep22a.ino (14.5 KB)

``````const int Code1MifareCard1 = '7';              // Determine here the first digit of your 6 digit PIN
const int Code2MifareCard1 = '7';              // Determine here the second digit of your 6 digit PIN
const int Code3MifareCard1 = '7';              // Determine here the third digit of your 6 digit PIN
const int Code4MifareCard1 = '2';              // Determine here the fourth digit of your 6 digit PIN
const int Code5MifareCard1 = '2';              // Determine here the fifth digit of your 6 digit PIN
const int Code6MifareCard1 = '2';              // Determine here the sixth digit of your 6 digit PIN
``````

Do those values LOOK like ints?

``````if ((RightCard == 1) &&                                                    // If you offered a valid Mifare Card and any DigitKey on the keypad is pressed
((KeyDigit == '1') ||
(KeyDigit == '2')  ||
(KeyDigit == '3')  ||
(KeyDigit == '4')  ||
(KeyDigit == '5')  ||
(KeyDigit == '6')  ||
(KeyDigit == '7')  ||
(KeyDigit == '8')  ||
(KeyDigit == '9')  ||
(KeyDigit == '0')  ||
(KeyDigit == '*')  ||
(KeyDigit == '#')))
``````

Since those are the only possible return value, you could just test that KeyDigit != NO_KEY.

The CodeNCorrect variables should be boolean. The code is either correct or it isn't. No sense wasting 16 bits to hold one bit's worth of data (although you still have to waste 8 bits).

What do your serial prints is telling you is happening?

I just get the codes on internet and I just edit some of it. Sorry I'm a newbie here. Where I must put the KeyDigit != NO_KEY on the program ?
Thank you.

siopao57:
I just get the codes on internet and I just edit some of it. Sorry I'm a newbie here. Where I must put the KeyDigit != NO_KEY on the program ?
Thank you.

``````if (RightCard == 1 && KeyDigit != NO_KEY)
{
// A key was pressed...
``````