Setting a pin HIGH is not saved

Using an ESP32-S3 to drive IBT_2 motor-driver
On this 2 pins have to be held high. In setup I have the code:

// Enable motor driver IBT_2 half-bridges
  #define R_EN 5  // Enable pin for right half-bridge
  #define L_EN 6  // Enable pin for left half-bridge
  digitalWrite(R_EN, HIGH);
  digitalWrite(L_EN, HIGH);
  Serial.printf("setup L_EN=%d R_EN=%d\n", digitalRead(L_EN),digitalRead(R_EN));

In loop() I also have the print line.
It always says: L_EN=0 R_EN=0
Is this a problem with the programming, the board or the motor-driver?

Solved
You need to set the pinMode first:

pinMode(R_EN, OUTPUT);
pinMode(L_EN, OUTPUT);

In that case, why waste 2 ESP pins? Connect those motor driver pins to 3.3V.

Hi I'm new to this. What is best way to connect the pins on the IBT_2 and the ESP32 3.3v (or VCC on IBT_2 if at 3.3V not 5v). I'm not using a breadboard so would need a custom wire with 4 Dupont sockets (which I can do!).
I only have two 3.3v pins on ESP32 for 3 preipherals so I'm going to have to have two wires from one 3.3 pin already

Use a breadboard. Or solder to stripboard.

Boards like most ESP32-based ones, and many other Arduino like the various Nano models, are designed to be used with breadboards & stripboards. There is no way they could be designed to have as many 3.3V or 5V or ground pins as any user could possibly want!

If you don't want to use a breadboard and don't want to solder your ESP32 board to anything just yet, use female PCB socket strips and stripboard. Don't forget to cut the copper strips under the ESP32 board so the pins don't short!


But attaching female Dupont cables direct to the ESP32 board just isn't a practical way to build a circuit, even in the short term.