Pages: 1 [2] 3 4   Go Down
Author Topic: using Keypad library for a full QWERTY keyboard  (Read 6821 times)
0 Members and 1 Guest are viewing this topic.
Phillipsburg, NJ
Offline Offline
Full Member
***
Karma: 6
Posts: 184
Author: Matrix Keypad Library
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
which leads me to think that i'm asking too much of the teensy in each pass of the matrix scan.

I don't think the teensy is having any problem handling even this many rows/columns. One reason I say that is because when you swap the getKey()'s the non-working keys work. And a second is because I had to add a bit of code to slow down the scanning of the pins. The teensy is capable of scanning the entire keyboard hundreds, or even thousands of times faster than any human could press a key.

Quote
would it be more likely to work if i used waitForKey() instead,

Not really because getKey() and waitForKey() call the same exact code.  Also, waitForKey() blocks which prevents any and all other code from running.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't think the teensy is having any problem handling even this many rows/columns. One reason I say that is because when you swap the getKey()'s the non-working keys work. And a second is because I had to add a bit of code to slow down the scanning of the pins.

in that case, what's the likelihood that i could get a modified version of keypad library from you? smiley

Logged

Phillipsburg, NJ
Offline Offline
Full Member
***
Karma: 6
Posts: 184
Author: Matrix Keypad Library
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Very good, actually. If you are up for it I am using you and your project to improve the library. smiley-wink

Last night I made a couple of changes that will fill an array with every key that is being pressed.  Once the array is filled (happens each time the keyboard is scanned) you can first check to see if a modifier was pressed and any other keys after that.

There are issues with matrix style keyboards called shadowing and jamming but careful arrangement of the rows and columns will support modifier keys. Unless your keyboard has built in series diodes for each key.(?)  That would eliminate those problems.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

nope. no diodes. just big fat copper traces and lumpy '80s solder joints. probably lots of lead, too.

thanks for taking the time to update your library for my edge case. i'll be glad to help debug, if i'm able.

Logged

Phillipsburg, NJ
Offline Offline
Full Member
***
Karma: 6
Posts: 184
Author: Matrix Keypad Library
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i'll be glad to help debug, if i'm able.

Works for me.  I can talk you through any debugging that we'll need to do.  It's simple stuff as you'll see.
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7189
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

mstanley,

I have not read through your recent library code so I will just ask you: are you waiting for debounce time in the library call getKey()? Two calls to getKey() should take little time if you just sense the input without waiting debounce time.
Logged


Phillipsburg, NJ
Offline Offline
Full Member
***
Karma: 6
Posts: 184
Author: Matrix Keypad Library
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi liudr,

I've been looking at some of your phi code. Nice work.

With version 2.0 of the keypad library there is no debouncing during the keyscan.  The debounceTime is only used inside the state-machine and runs only after the keyscan is done.

Here's the heart of the keyscan code:
Code:
for( int c=0; c<size.columns; c++) {
digitalWrite(columnPins[c], LOW);
for( int r=0; r<size.rows; r++) {
curKey = digitalRead(rowPins[r]);
allKeys += curKey;
if(curKey==0)
currentKey = keymap[c+(r*size.columns)];
}
digitalWrite(columnPins[c], HIGH);
}
The variable allKeys provides a status to the state-machine.

Oops, almost forgot to answer your implied question.  I'm not sure what's happening but I suspect that one of the static variables may be getting shared between the two instances of keypad.  I will have to hook up a second keypad and see if I can pin down the problem.
« Last Edit: January 11, 2012, 07:48:30 pm by mstanley » Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7189
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I see. I've ordered 2 4*4 keypads and will try them on one arduino with two keypad objects with my keypad library.

Here is my most recent activity regarding library:

http://arduino.cc/forum/index.php/topic,85557.0/topicseen.html
Logged


Phillipsburg, NJ
Offline Offline
Full Member
***
Karma: 6
Posts: 184
Author: Matrix Keypad Library
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I see. I've ordered 2 4*4 keypads and will try them on one arduino with two keypad objects with my keypad library.

Cool.  I would appreciate any feedback.  I have a feeling that it may take a little while to pin down the problem.

Right now I'm working on a solution so option8 can use multiple keypresses without having to load two instances of keypad.
Logged

Phillipsburg, NJ
Offline Offline
Full Member
***
Karma: 6
Posts: 184
Author: Matrix Keypad Library
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

option8,

  I tried to PM you but the system is down.  Hopefully you'll see this post then.

I've made some progress on reading multiple keypresses.  There are a couple of things you will need to pay attention to but right now it will read up to 10 simultaneous key presses.  Let me if you reply I will post the changes here.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi there,

I just raced trough the post, but perhaps my problem is related:
http://arduino.cc/forum/index.php/topic,91932.0.html
Let me know if following your examples would be the right path and where to continue this (in my new thread or here)

Thanks

mclien
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

if you've mapped all the matrix connections, and have enough pins on the teensy to handle all the necessary inputs, then you could probably take what we're talking about in this topic and run with it for your project.

send me your email in a PM and i'll send you a copy of my latest sketch. you'll need to get mstanley to send you the latest keypad library as well.

good luck! (and post pics/links when you have a chance)

Logged

Phillipsburg, NJ
Offline Offline
Full Member
***
Karma: 6
Posts: 184
Author: Matrix Keypad Library
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I can't send anything right now until I get some homework done.  I've heavily modified the library since I last sent it to you option8.  Probably won't be until this weekend before I could do anything.

option8, would you mind sending him a copy of the library that I gave you? 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 32
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

if you've mapped all the matrix connections, and have enough pins on the teensy to handle all the necessary inputs, then you could probably take what we're talking about in this topic and run with it for your project.
I have mapped all the matrix connections. The teensy has enought pins, but I still don't know if I can mix the analog and digital pins for that or if all matrix connections have to be the same sort of input (analog or didgital). If they have to be "same kind" I have to look if the teensy ++ is a way to go. IIRC I need 24 pins altogether (6x14, maybe 6x18), have to look that up at home.

Logged

Phillipsburg, NJ
Offline Offline
Full Member
***
Karma: 6
Posts: 184
Author: Matrix Keypad Library
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The matrix keypad library will let you assign any pin numbers you like but will not be able to use the analog pins in their analog state.  I'm not sure about the teensy but there are quite a few posts that describe how to configure the analog-in pins for digital use. 

Is that what you are talking about?
Logged

Pages: 1 [2] 3 4   Go Up
Jump to: