Making door lock need help w code

Hi, im attempting to build a circuit which basically switches on and off a relay when a six digit code is typed into a keypad module, or when an ir signal is recieved from my remote. Both codes work separately at the moment, the matrix keypad code, and the ir code, but im having trouble combining the code into one sketch, as the program seems to be ignoring the ir portion of it and is only waiting for keypad input.

protolockYERR.ino (2.62 KB)

If you properly indented your code, using Tools + Auto Format, you'd see that you are only concerned about the IR when dataCount equals 6.

To me, that feels wrong.

I may be wrong (often am) as it's some time since I used keypad but I think getKey is a blocking looping function.

It will go to loop look for a key input, back to function, back to loop waiting for a key press and block in the meantime. So it will ignore the IR part of the loop as it races round waiting for a keypress. I think you need to put the IR 'if' in the getKey loop

I may be wrong (often am) as it's some time since I used keypad but I think getKey is a blocking looping function.

getKey() is not a blocking function. It simply returns whatever key is pressed, if any, when the function is called.

waitForKey() is a blocking function.

Ah corrected....I was wrong but close