Keypad Problem with Teensy 4

Sandip

Member
Hello everyone,

Problem :
I used the same pins no. for the keypad for Teensy 3,2 and 4, when I connect the keypad to Teensy 3,2 it works fine, but when I connect it to Teensy 4 it displays an automatic number that I did not press. I use the same Cable.

I have checked (R1,R2,R3,R4,C1,C2,C3) the keypad and Teensy 4 with a multimeter and the signal is OK (e.g. when I press 1, R1 and C1 make contact).

What should I have to check?

Thank you in advance and I await your reply.

Regards
Sandip
 
Hello everyone,

Problem :
I used the same pins no. for the keypad for Teensy 3,2 and 4, when I connect the keypad to Teensy 3,2 it works fine, but when I connect it to Teensy 4 it displays an automatic number that I did not press. I use the same Cable.

I have checked (R1,R2,R3,R4,C1,C2,C3) the keypad and Teensy 4 with a multimeter and the signal is OK (e.g. when I press 1, R1 and C1 make contact).

What should I have to check?

Thank you in advance and I await your reply.

Regards
Sandip
Hard to say for sure, without seeing more information, like what code is run, using library? if so which one, and wiring...
But guessing, that maybe timing issue. Like again don't know what keypad code you are using, but for example if you do a digitalWrite(...) to change rows or columns, maybe add a real small delay before you then read the pins and see if that helps.
 
Hard to say for sure, without seeing more information, like what code is run, using library? if so which one, and wiring...
But guessing, that maybe timing issue. Like again don't know what keypad code you are using, but for example if you do a digitalWrite(...) to change rows or columns, maybe add a real small delay before you then read the pins and see if that helps.


Hello,

Below I have posted the code for the keypad.

Can i add time delay before char customKey = customKeypad.getKey()??


Code:
#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {23, 22, 21, 20};
byte colPins[COLS] = {12, 11, 9};

Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); 

void setup(){
  Serial.begin(9600);
}
  
void loop(){
  char customKey = customKeypad.getKey();
  
  if (customKey){
    Serial.println(customKey);
  }
}
 
Last edited by a moderator:
As a first very simple test to check if slower speed helps, try setting Tools > CPU Speed to only 24 MHz and upload again.
 
Hello Paul,

Thank you very much for your answer. I changed my CPU speed to 150 MHz (Tools->CPU Speed) and now it works fine. Thank you again.

Have a nice day.

Regards
Sandip
 
Back
Top