Compiling 'adutoSecuritySystem' for 'Arduino Mega w/ ATmega2560 (Mega 2560)'
keypad_api.cpp:In member function 'void Keypad_apiClass::createKeypadventHandler()'
keypad_api.cpp:112:50: error: no matching function for call to 'Keypad::addEventListener()'
keypad_api.cpp:candidate is
Keypad.h:addEventListener(void ()(char))
Keypad.h:no known conversion for argument 1 from '' to 'void ()(char)'
Error compiling
It would seem that the addEventListener is not accepting the type of "screenState_keyHandler".
I'm not sure how to fix this.
Any help will be appreciated. Thanks.
Compiling 'adutoSecuritySystem' for 'Arduino Mega w/ ATmega2560 (Mega 2560)'
keypad_api.cpp:In member function 'void Keypad_apiClass::createKeypadventHandler()'
keypad_api.cpp:112:50: error: no matching function for call to 'Keypad::addEventListener(<unresolved overloaded function type>)'
keypad_api.cpp:candidate is
Keypad.h:addEventListener(void (*)(char))
Keypad.h:no known conversion for argument 1 from '<unresolved overloaded function type>' to 'void (*)(char)'
Error compiling
I can see that the addEventListener accepts functions of type "void (*)(char) " as the parameter.
So where in my code do I have to fix this?
That was just a typo. That's fixed.
2.The keypad.h file is included. I just didnt want to include the whole code. I only included the parts relevant to the problem.
Observe that when the "keypadEvent" is defined just below the loop() function. Also, observe that "keypadEvent" is passed as a parameter to keypad.addEventListener() in the setup() function.
That's exactly what I did too. I defined "screenState_keyHandler" and then pass it as a parameter: