Pages: [1]   Go Down
Author Topic: Keypad.h  (Read 2685 times)
0 Members and 1 Guest are viewing this topic.
Durham UK
Offline Offline
Full Member
***
Karma: 1
Posts: 167
aka Craig Turner
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Hi,
I’m using a keypad these with the Keypad.h library and, yes it works fine. But I don’t understand how the arduino is handling the input from it. I get that when a key is pressed a connection is made between a row and a column pin, which when read by arduino gives us a particular key as a result.

When I attached my ohm meter to various pins on the keypad I was basically measuring a drop in resistance (probably Megohms down to a few ohms) when a connection was made and the matrix from these tests gave me the data for the library to use. I understand that to calculate ohms (R) you can use V and I.
Does anyone know how the arduiono is handling these inputs?

I already tried looking at the keypad.h file and didn’t get any further either.

Cheers
Logged

Craig Turner, blog: http://gampageek.blogspot.co.uk/ It helps with my learning if I write things down, esp. for others to follow (constructive comments welcomed to improve)

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 211
Posts: 13471
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you post a link to your keypad.h library?

There should also be one or more .cpp files.

The working is as follows:

the rows are outputs
the columns are input
The Arduino sets row 1 high.
then it checks all the columns if a line is becoming high if so key found
if none it does the same for row 2,3,4
If no line is found high return KeyNone or something like that.

(rows & columns can be swapped)


Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Durham UK
Offline Offline
Full Member
***
Karma: 1
Posts: 167
aka Craig Turner
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's the link:

arduino.cc/playground/uploads/Code/keypad.zip

robtillaart many thanks for the explanation, I think I understand it now.

Although the C files make heavy reading, I can see that they appear to be pulsing and checking row and column pins.

Cheers
Logged

Craig Turner, blog: http://gampageek.blogspot.co.uk/ It helps with my learning if I write things down, esp. for others to follow (constructive comments welcomed to improve)

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 211
Posts: 13471
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you should read the scankeys() function, that's the workhorse in this lib.

the implementation is more robust and has some additional functionality, e.g. it also suppresses bouncing switches so you get only one key instead of a zillion smiley-wink
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Durham UK
Offline Offline
Full Member
***
Karma: 1
Posts: 167
aka Craig Turner
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Many thanks again. I'll check it out.

I believe it's a good idea for me understand the stuff I'm using in more depth, now.

I've been using arduino for just over 12 months now.  It's a bit off post, but I just bought this book http://www.amazon.co.uk/Introduction-Embedded-Systems-Development-Environment/dp/1608454983/ref=sr_1_9?s=books&ie=UTF8&qid=1352488796&sr=1-9 to help speed the path to better understanding  smiley

Cheers
Logged

Craig Turner, blog: http://gampageek.blogspot.co.uk/ It helps with my learning if I write things down, esp. for others to follow (constructive comments welcomed to improve)

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 211
Posts: 13471
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

at first sight a very interesting book!
I put it on my wishlist
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Pages: [1]   Go Up
Jump to: