Defining pins for the esp32 wroom 32

yeah I just added 0 to the list because that should be the G0 pin but the rest is the same wait I'll post the code again:

#include <Arduino.h>

int pinsToCheck[] = {32, 33, 34, 35, 25, 26, 27, 14, 12, 13, 2, 3, 23, 22, 19, 18, 17, 16, 4, 2, 15, 0};
int numPins = sizeof(pinsToCheck) / sizeof(pinsToCheck[0]);

void setup() {
  Serial.begin(9600);
  for (int i = 0; i < numPins; ++i) {
    pinMode(pinsToCheck[i], INPUT);
  }
  while (!Serial) {
    // Warte, bis die serielle Verbindung hergestellt ist
  }
}

void loop() {
  for (int i = 0; i < numPins; ++i) {
    int pinState1 = digitalRead(pinsToCheck[i]);
    Serial.print("Pin ");
    Serial.print(pinsToCheck[i]);
    Serial.print(" State: ");
    Serial.println(pinState1);
    
    for (int j = i + 1; j < numPins; ++j) {
      int pinState2 = digitalRead(pinsToCheck[j]);
      Serial.print("Pin ");
      Serial.print(pinsToCheck[j]);
      Serial.print(" State: ");
      Serial.println(pinState2);

      if (pinState1 && pinState2) {
        Serial.print("Connected: ");
        Serial.print("Pin ");
        Serial.print(pinsToCheck[i]);
        Serial.print(" and Pin ");
        Serial.println(pinsToCheck[j]);
      }
    }
  }
  Serial.println();  // Leere Zeile für bessere Lesbarkeit im Serial Monitor
  delay(1000);
}

So what does the new code do?
Your last print out said pin3 connected to pin 1 but there is no pin 3 in the printout.

that is because it is just a outcut of the output I cant paste the whole output in here that would be too long but it is in the output.

Pin 22 State: 0
Pin 19 State: 0
Pin 18 State: 0
Pin 17 State: 0
Pin 16 State: 0
Pin 4 State: 0
Pin 2 State: 0
Pin 15 State: 0
Pin 0 State: 1
Pin 12 State: 0
Pin 13 State: 0
Pin 2 State: 0
Pin 3 State: 1
Pin 23 State: 0
Pin 22 State: 0
Pin 19 State: 0
Pin 18 State: 0
Pin 17 State: 0
Pin 16 State: 0
Pin 4 State: 0
Pin 2 State: 0
Pin 15 State: 0
Pin 0 State: 1
Pin 13 State: 0
Pin 2 State: 0
Pin 3 State: 1
Pin 23 State: 0
Pin 22 State: 0
Pin 19 State: 0
Pin 18 State: 0
Pin 17 State: 0
Pin 16 State: 0
Pin 4 State: 0
Pin 2 State: 0
Pin 15 State: 0
Pin 0 State: 1
Pin 2 State: 0
Pin 3 State: 1
Pin 23 State: 0
Pin 22 State: 0
Pin 19 State: 0
Pin 18 State: 0
Pin 17 State: 0
Pin 16 State: 0
Pin 4 State: 0
Pin 2 State: 0
Pin 15 State: 0
Pin 0 State: 1
Pin 3 State: 1
Pin 23 State: 0
Pin 22 State: 0
Pin 19 State: 0
Pin 18 State: 0
Pin 17 State: 0
Pin 16 State: 0
Pin 4 State: 0
Pin 2 State: 0
Pin 15 State: 0
Pin 0 State: 1
Connected: Pin 3 and Pin 0
Pin 23 State: 0
Pin 22 State: 0
Pin 19 State: 0
Pin 18 State: 0
Pin 17 State: 0
Pin 16 State: 0
Pin 4 State: 0
Pin 2 State: 0
Pin 15 State: 0
Pin 0 State: 1

And for your first question, this code should give out which pin is connected to which, I wanted to make something like a keyboard.

The following diagrams when read together should remove all confusions:
1. Signal Signatures of 38-pin ESP32 Dev Board (Fig-1) which OP owns:


Figure-1:

2. Signal Signatures of 38-pin ESP32-WROOM-32 Module (Fig-2);

3. Pin Mapping among 30-pin ESP32 Dev Module, 38-pin ESP32-WROOM-32 Module, and 48-pin ESP32 Chip/MCU (Fig-3)


Figure-3:

4. Signal Signatures of 30-pin ESP32 Dev Module which I own (Fig-4):

Figure-4:

thank you very much :slight_smile: Just one other question, is there any way to write a code, that checks if two pins are connected to each other? Like G0-G13 are PULLUPs and G14-23 INPUTS but the code checks if G0 is connected to G14 or G5 to G14 is that in any way possible?

You have all pins defined as inputs. Connecting two inputs together could result in both reading a 0 or 1.
There is no way of knowing if two inputs are connected together

Yes.
Make all pins input with a pull-up resistor.
Read the state of any pin while you make the other pins output LOW one at a time.
When the pin state goes low then you found the two pins that are connected

Why are you suspecing that some of the IO lines are internally shorted due to manufacturing defects?

You search the net and the data sheets of ESP32 MCU to see which lines work only as input, or as output, or as bi-directional.

Do you have problems with your 38-pin ESP32 Dev Board such that one or more IO lines are not working as expected? What are those lines -- GXX?

no everything is fine with my board but I couldnt figure out away how to check if 2 pins are connected (excactly those 2 pins) . What do you mean with, am i suspecting some of the IO lines are internaly shorted, and in which lines is "GXX" written?

thanks, I used this code:

`
const int numPins = 10; // Anzahl der Pins
int pins[numPins] = {25, 24, 26, 5, 6, 7, 8, 9, 10, 11};

void setup() {
Serial.begin(9600);
while (!Serial);

for (int i = 0; i < numPins; i++) {
pinMode(pins[i], INPUT_PULLUP);
}
}

void loop() {
for (int i = 0; i < numPins; i++) {
pinMode(pins[i], OUTPUT);
digitalWrite(pins[i], LOW);

for (int j = 0; j < numPins; j++) {
  if (j != i) {
    if (digitalRead(pins[j]) == LOW) {
      Serial.print("Pins verbunden: ");
      Serial.print(pins[i]);
      Serial.print(" und ");
      Serial.println(pins[j]);
    }
  }
}

pinMode(pins[i], INPUT_PULLUP);

}
delay(1000);
}

`

but that was the output:
⸮ ҉\⸮⸮⸮⸮
O⸮⸮ ]⸮⸮⸮ B v3⸮⸮

1. Only input IO lines of ESP32 MCU:

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

i clicked the code button and the code is written (like I should do) in ´

I don't know what you did but the easiest way to post code is to use Edit/Copy for forum in the IDE menu and paste it into a reply here. The code tags are added automatically for you

I think you changed the baud rate in he serial monitor

Hi @nogoisjalogo ,
Welcome to the forum..

Check the baud rate setting in your serial monitor..
a nice reference..
ESP32 Pinout Reference: Which GPIO pins should you use?

have fun.. ~q

yeah already tried that, thanks. The problem were some of the pins I wanted to set (they didnt exist really or I werent able to digitalWrite them) fixed that and the code funcs now (after 2 days of full searching and redoing)