Go Down

Topic: Trouble with any sketch that uses a library (Read 6085 times) previous topic - next topic


Sitting in front of another Win7 PC and just installed the 1.0 IDE and downloaded the Keypad Library. I'm still getting the same problems. What am i missing here?

Has the last 2 years really made me forget this much about Arduino?


Feb 08, 2012, 07:38 pm Last Edit: Feb 08, 2012, 07:56 pm by dxw00d Reason: 1
FWIW, I've just downloaded the library onto my MacBook, with IDE 1.0, and I get the same issue with the HelloKeypad sketch. Never had a problem with any other libraries.

EDIT: Just noticed, there are two tabs in the sketch, with the same code in. If I save the sketch with a new name, and delete the second tab, it's fine.

All the keypad example sketches have the same issue. Is it because there is both an ino and a pde copy in each directory? I renamed the pde to .scrap, and re-opened the HelloKeypad sketch. Only one tab, no problem compiling.


Wow i didn't notice that before. I'll bet its creating a tab for the older IDEs and one for IDE 1.0. Somehow having 2 tabs may be messing with the compiler. Neither tab will compile.

I saved the sketch under a different name and it compiles as it should. Now i can go home tonight and get everything wired up and see if its even going to work for me. I not sure if there will be any problem if the Arduino is using a keypad that belongs to another device that is still using it. I'm trying to use the Arduino to pick up button presses on my Casio Keyboard so the Arduino can display which Tone or Beat i'm using on the Keyboard. Just hope there isn't any conflict due to the voltage on the buttons. But i'll save that for another thread once i've done some testing of my own.

Thanks all. 


Just hope there isn't any conflict due to the voltage on the buttons. But i'll save that for another thread once i've done some testing of my own.

I think you can count on the fact that there WILL be problems. The keypad library applies voltage to each row, and reads whether any switch on each column is pressed. If there is another voltage source, the keypad library will not return correct results.


i have the same problem ! transfered the keypad library to where my sketches are saved ! i opened the examples from file - sketchbook - libraries - keypad - examples - CustomKeypad

but still when i compile the sketch i get this problems

CustomKeypad:48: error: redefinition of 'const byte ROWS'
CustomKeypad:11: error: 'const byte ROWS' previously defined here
CustomKeypad:49: error: redefinition of 'const byte COLS'
CustomKeypad:12: error: 'const byte COLS' previously defined here
CustomKeypad:51: error: redefinition of 'char hexaKeys [4][4]'
CustomKeypad:14: error: 'char hexaKeys [4][4]' previously defined here
CustomKeypad:57: error: redefinition of 'byte rowPins [4]'
CustomKeypad:20: error: 'byte rowPins [4]' previously defined here
CustomKeypad:58: error: redefinition of 'byte colPins [4]'
CustomKeypad:21: error: 'byte colPins [4]' previously defined here
CustomKeypad.cpp: In function 'void setup()':
CustomKeypad:63: error: redefinition of 'void setup()'
CustomKeypad:26: error: 'void setup()' previously defined here
CustomKeypad.cpp: In function 'void loop()':
CustomKeypad:67: error: redefinition of 'void loop()'
CustomKeypad:30: error: 'void loop()' previously defined here

i am runing on windos 7 ! Has anyone have an idea why ?


It seems someone else is also having this problem. Here is my library, which you are welcome to try:


Except for how to instantiate a keypad, the call to sense the keypad is the same so there is minimal change on your code. You do getKey and the return is either a key name, such as 'A' or NO_KEY. Besides, you can use buttons, rotary encoders etc. virtually any input device with this call.

BTW, please don't use pins 0 and 1. They are the serial pins.
Serial LCD keypad panel,phi_prompt user interface library,SDI-12 USB Adapter


i have the same problem !

Did you read reply #16?


i am runing on windos 7 ! Has anyone have an idea why ?

I presume it came with your PC   XD


I presume it came with your PC

No. No. He/she is a glutton for punishment and installed Win7.


Alright, for anyone else who follows this thread:

I've known about this problem since before Arduino 1.0 was released but there was nothing I could do about it short of removing the .pde example files.  For a time I knew people would still be using the keypad library with older IDE's and I didn't want to cut them off right away.

But now I've removed them so Arduino 1.0 will find the .ino example files without copying and renaming the .pde's and leaving two copies.  That should fix the problem from now and into the future.

If you want the old .pde files you will have to find the examples folder and rename each of the example files with the .pde file extension.



I fought with the same problem until I discovered that the examples had 2 tabs with the same code. Delete one tab so it seems to work.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131