Using the Sparkfun 12 Button Keypad, With the Arduino

72,647

48

19

Posted

Introduction: Using the Sparkfun 12 Button Keypad, With the Arduino

 Hi guys, well bought this keypad, and wasn't exactly sure how to wire it up, because the pins aren't in order!

well, I will give you a schematic, and code to have it up and running in no time...



Step 1: Wiring

The image says it all...
the resistors can be anything betwen 1Kohm, and 10Kohm.
they go from pin 3, 5, 6 and 7 to +5V.

Step 2: Code

 Removed directly from the arduino.cc website, the only mod, was the pins i chose...
the code is attached, instructables won't let me paste it onto here for some reason...

The code will print the numbers of they keys you pressed, to the COM port.
also, be sure to have the library ''keypad'' in your libraries folder, or this code will not compile.

To use similar, but not equal keypads, just grab your continuity tester, and press those buttons, you will easily find wich pins are for the rows, and wich are for the columns.


IF you need any help, just ask in the comments :)





Share

    Recommendations

    • Microcontroller Contest

      Microcontroller Contest
    • Science of Cooking

      Science of Cooking
    • Pocket-Sized Contest

      Pocket-Sized Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    18 Comments

    i have this error:
    In file included from C:\Users\Ricardo\Documents\Arduino\libraries\Keypad\Examples\CustomKeypad\CustomKeypad.pde:10:0:
    C:\Users\Ricardo\Documents\Arduino\libraries\Keypad/Keypad.h:36:22: fatal error: WProgram.h: No such file or directory
    #include
    ^
    compilation terminated.
    exit status 1

    Thank you for this tutorial. I'm a Arduino newbie, so it was exactly what I was looking for to continue my vending project for my son. I was wondering if you had any examples of how to make a servo rotate if a correct "code" is put into the keypad? I've been searching like crazy but haven't come across any examples.

    hi! have you found the answer? I can help you, just email me: samukafranco@gmail.com

    Put the keys into an array, compare the array to a predefined array of the "correct" code with an if statement, if equal then rotate servo, if not beep or whatever, take things by parts, break down big algorithms into small algorithms and you have no trouble doing anything.

    I know little electronics than I should for what I'm doing but why do you say to wire contacts 3, 5, 6, 7 to resistors then 5v when you also say to connect them to pins on the Arduino. Surely you don't mean to connect it like that? I'd be much appreciated if you could clear my confusion.

    hello, I'm wondering did you get this question answered? plug it into arduino pin and 5 volts? how?

    Aye, look: http://www.arduino.cc/en/Tutorial/Button A resistor is needed, it might work without resistors, but they are keeping all the buttons high, without them the buttons will float and caus bad readings.

    I have a problem where the arduino program says, 'byte' does not name a type. If you know, how can I fix this problem?

    Which board/program version do you have? probably something that changed, try uint8_t instead of byte

    I have the Arduino UNO SMD board. The arduino program that I have is Arduino 1.0.