Numpad gibt durchgehend 1 aus

Hi, ich habe das Problem, dass mein 4x4 Numpad durchgehend die 1 in den Serial Monitor schickt.
Vielleicht kann mir ja jemand helfen.
Das ist mein Code

#include <Keypad.h>
 
// Definition für das Keypad von Elegoo
const byte ROWS = 4; // vier Zeilen
const byte COLS = 4; // vier Spalten
// Symbole auf den Tasten
char hexaKeys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};
byte rowPins[ROWS] = {35, 32, 33, 25}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {26, 27, 14, 12}; //connect to the column pinouts of the keypad

// Instanz von Keypad erzeugen, Keymap und Pins übergeben
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); 
 
void setup(){
  Serial.begin(9600);
}
 
void loop(){
  // Gedrückte Taste abfragen
  char customKey = customKeypad.getKey();
 
  if (customKey) {
      Serial.println(customKey);
    }
  else{
    }
}

Nein!

Ich kann dir nicht helfen!
Mein Keypad funktioniert.

Prüfe ob deins kaputt/heile ist.

@ender1556
na dann zeig mal Bilder von deinem Aufbau. Jedes Kabel muss eindeutig sichtbar sein wo es drinnen steckt.
Gib an welchen Microcontroller du verwendest.

Ich benutze einen Esp32s von AZDelivery

Da bin ich ja beruhigt, kann nicht mitreden....

Tipp:
Zum Glück gibts ja nur ein einziges ESP32 Board mit nur einem einzigen ESP32 Modell.
(das war ein Scherz)

Die stimmen alle und wenn ich drauf drücke kommt auch ne andere Zahl raus aber sobald ich wieder loslasse spammt es wieder die 1

Das die stimmen, ist zu sehen, aber es fehlt die Angabe, was Du bekommst, wenn Du auf die jeweiligen anderen Tasten drückst.

Du drückst 1 und bekommst?
Du drückst 2 und bekommst?
Du drüc.. na Du weisst schon.

Ich bekomme die richtigen Tasten aber die 1 halt auch wenn ich sie nicht drücke

Dann einmal mit keypad laufen lassen und einmal ohne.
Beim ersten Versuch muss mindestens einmal ein PIN auf 1 gehen alle anderen 0 und beim zweiten Versuch - ohne Keypad - alle auf 0 bleiben.

const byte ROWS = 4; // vier Zeilen
const byte COLS = 4; // vier Spalten

byte rowPins[ROWS] = {35, 32, 33, 25}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {26, 27, 14, 12}; //connect to the column pinouts of the keypad


void setup()
{
  Serial.begin(9600);
  findKey();
}

void loop()
{
}

void allInput()
{
  for (byte b = 0; b < 4; b++)
  {
    digitalWrite(rowPins[b], LOW);
    digitalWrite(colPins[b], LOW);
    pinMode(rowPins[b], INPUT);
    pinMode(colPins[b], INPUT);
  }
}

void findKey()
{
  for (byte c = 0; c < 4; c++)
  {
    allInput();
    pinMode(rowPins[c], OUTPUT);
    digitalWrite(rowPins[c], HIGH);
    Serial.print(F("Sendepin: "));
    Serial.println(rowPins[c]);
    for (byte d = 0; d < 4; d++)
    {
      Serial.print(colPins[d]);
      Serial.print('=');
      Serial.print(digitalRead(colPins[d]));
      Serial.print('\t');
    }
    Serial.println();
  }
  Serial.println(F("Ende"));
}

So geht das bei mir auch nicht.
Ändere mal die Pins, so klappt das bei mir:

byte rowPins[ROWS] = {19, 18, 5, 17}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {16, 4, 0, 2}; //connect to the column pinouts of the keypad

Ich denke es liegt an Pin 27

Das funktioniert danke

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.