how to test if one or more specific pins are not working??

charnjit

Well-known member
i have solder male header pins to teensy lc in this way
1767217781865.jpg

my 4 pins are reserve for 0 and 1 for midi , 18,19 for i2c display , next i want to use 20 pins of teensy lc in as keypad pins (14rowX6col=84 keys). but there is trouble with pins .
because of when i tried matrix of 11 r X 6 c = 66 keys with below code
C++:
#include <Keypad.h>
#include <MIDI.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

const byte ROWS = 11; // 
const byte COLS = 6; // 
char keys[ROWS][COLS] = {
{ 1, 2, 3, 4, 5, 6},
{ 7, 8, 9,10,11,12},
{13,14,15,16,17,18},
{19,20,21,22,23,24},
{25,26,27,28,29,30},
{31,32,33,34,35,36},
{37,38,39,40,41,42},
{43,44,45,46,47,48},
{49,50,51,52,53,54},
{55,56,57,58,59,60},
{61,62,63,64,65,66}
};
byte rowPins[ROWS] = {2,3,4,5,6,7,8,9,10,11,12 }; // 
byte colPins[COLS] = {21,22,23,24,25,26}; // 

Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
  MIDI_CREATE_DEFAULT_INSTANCE();



void setup() {
    Serial.begin(9600);
    Serial.print ("KeyPad Test");   delay(2000);
}


void loop() {
    if (kpd.getKeys())
    {
        for (int i=0; i<LIST_MAX; i++)   // Scan the whole key list.
        {      int mykey = kpd.key[i].kchar;
            if ( kpd.key[i].stateChanged )    // Only find keys that have changed state.  [1-48keys]
            {
                switch (kpd.key[i].kstate) {  // Report active key state : IDLE, PRESSED, HOLD, or RELEASED
                    case PRESSED:
                   Serial.print(mykey);   Serial.println("  pressed"); 
                break;
                    case RELEASED:
 Serial.print(mykey);   Serial.println("  releassed"); 
                break;
                  
                }
            }
        }
    }
}// End loop
without connect or touch to any pin of teensy lc, i not found any poblem in serial monitor got only KeyPad Test and wait for new key event .
but when i add 3 more rows pins to get total 84 keys with code
C++:
const byte ROWS = 14; // 
const byte COLS = 6; // 
char keys[ROWS][COLS] = {
{ 1, 2, 3, 4, 5, 6},
{ 7, 8, 9,10,11,12},
{13,14,15,16,17,18},
{19,20,21,22,23,24},
{25,26,27,28,29,30},
{31,32,33,34,35,36},
{37,38,39,40,41,42},
{43,44,45,46,47,48},
{49,50,51,52,53,54},
{55,56,57,58,59,60},
{61,62,63,64,65,66},
{67,68,69,70,71,72},
{73,74,75,76,77,78},
{79,80,81,82,83,84}
};
byte rowPins[ROWS] = {2,3,4,5,6,7,8,9,10,11,12,13,15,16 }; //
byte colPins[COLS] = {21,22,23,24,25,26}; //
i am getting in detect event in Serial monitor forever
Code:
67  pressed
67  pressed
67  pressed
67  pressed
67  pressed
67  pressed
67  pressed
67  pressed
67  pressed
67  pressed
67  pressed
67  pressed
67  pressed
67  pressed
67  pressed
67  pressed
67  pressed
i think key 67 is related to 12th row . i also tried replace 12th row pin with pins (13,14,17,20,21 )
but no changes . same above result found.
?? is there keys number are limited to 66 keys??
?? may it pin soldering mistake??

but after soldering my board is running well.
?? is there a prog/ code to test each pins is working or not working seprately for teensy lc.??
plaese test my code with matrix of 14x6 for teensy lc if possible .
?? what should i do here next ??


thank you.....
 
Pin 13 is the LED pin. It might be causing problems. Try using a different pin.

Pete
I have tried pins 14,17,20,21 already . They not work.
Note: i tested pins 13,14,17,20,21 works only when key matrix is 11row X 6col.
Cause trouble only when I add rows More than 11. All pins works if we use rows less than 12 keys upto 66
 
Looks like the ancient Keypad library is in serious need of a bit of maintenance. Even though you can apparently specify the number of rows, it actually only allows for ten rows of 16 columns. Except that it’s possibly 32 columns for Teensy, because an int is 32 bits…

You could edit the library, or just swap your rows and columns so your matrix is 6x14 rather than 14x6.
 
Thank you h4yn0nnym0u5e
By editing keypad.h for max rows , it is solved. No need to install with new.
Thank you....
 
Back
Top