Hi, I'm new to Arduino and I've run into a problem. Once downloaded the OnewireKeypad library from Andrew Mascolo I saw that it does not contain the cpp file. I took the code from the library page (Arduino Playground - OneWireKeypad Library) and saved it as OnewireKeypad.cpp in the library folder. When running the examples I receive the message "error: 'ExtremePrec' was not declared in this scope".
I have reviewed as far as I can and I do not know what else to do. Could anyone help me? Thank you.
Not all libraries have a .cpp file; sometimes everything is in the .h file.
Not familiar with the library, just download, unzip and copy the unzipped directory to the location for 3rd party libraries; remove the -master part from the directory name. restart IDE and next look at the examples.
I forgot to attach the code I used to save the cpp file, taken from the library link (Arduino Playground - OneWireKeypad Library)
#include <OnewireKeypad.h>
#define Rows 4
#define Cols 3
#define Pin A0
#define Row_Res 4700
#define Col_Res 1000
// ExtremePrec, HighPrec, MediumPrec, LowPrec
#define Precision ExtremePrec
char KEYS[]= {
'1','2','3',
'4','5','6',
'7','8','9',
'*','0','#'
};
OnewireKeypad <Print, 12> KeyPad(Serial, KEYS, Rows, Cols, Pin, Row_Res, Col_Res, Precision );
Dear sterretje, thank you for your advice. I did what you ask, the message no longer appears but I still can not use the library and the examples.
On the library page in Getting Started says "To get started you need add some data into the constructor." I thought the constructor was the cpp file. Can you please tell me what does that phrase mean and where I have to add that data?
I downloaded the library from GitHub - AndrewMascolo/OnewireKeypad: One Wire Keypad; click clone and download the zip to somewhere, not to the libraries folder.
In the IDE, I used menu sketch -> include library -> add .zip library, browsed to the zip and installed it. This added the library to C:\Users\sterretje\Documents\Arduino\libraries as OneWireKeypad-master (windows system). I renamed the folder to get rid of the -master part.
I opened the KP_Password example and compiled it. It throws plenty warnings but does compile.
PS
No idea what that phrase means; look how the examples work. A cpp file is not a constructor ![]()
Thanks a lot sterretje. I'll follow your advices.
OnewireKeypad <Print, 12> KeyPad(Serial, KEYS, Rows, Cols, Pin, Row_Res, Col_Res, Precision );
That line of code is the constructor. It constructs an object called KeyPad. That object belongs to the class OnewireKeypad. The class is defined in the .h file.