One ESP32's 3v3 is connected to GPIO 26 of another ESP32. The program is uploaded. The built-in LED lights for two seconds as expected. Then, it turns off. No matter what GPIO pin the 3v3 is connected to (besides 2), the LED remains off.
/*
* ON Board LED GPIO 2
*/
#define LED 2
#define inPin 26
void setup()
{
Serial.begin(9600);
// Pins 34, 35, 36, 39 are input only
pinMode(LED, OUTPUT);
// Sanity check LED works
digitalWrite(LED, HIGH);
delay(2000);
}
void loop()
{
Serial.println(digitalRead(inPin));
digitalWrite(LED, digitalRead(inPin));
}
gpio_config_t io_cfg = {}; // initialize the gpio configuration structure
io_cfg.mode = GPIO_MODE_INPUT; // set gpio mode. GPIO_NUM_0 input from water level sensor
io_cfg.pin_bit_mask = ( (1ULL << GPIO_NUM_26)); //bit mask of the pins to set, assign gpio number to be configured
would set pin 26 to input
and
io_cfg = {};
io_cfg.mode = GPIO_MODE_OUTPUT;
io_cfg.pin_bit_mask = ( 1ULL << GPIO_NUM_2 ); //bit mask of the pins to set, assign gpio number to be configured
gpio_config(&io_cfg);
gpio_set_level( GPIO_NUM_4, LOW); // deenergize relay module
pinMode(LED, OUTPUT);
// Sanity check LED works
digitalWrite(LED, HIGH);
delay(2000);
This switches the output on and turns off the LED straight away. Then it should stay off as-long as you apply 3.3v, and once you ground the pin, the LED should turn 'on' The builtin LED is 'active-low'
Arduino GPIO automatically set as inputs, so I assume the same is true for ESP32.
Yes it is, but you actually would want to set it INPUT and with have a pulldown resistor, since you want to test if it responds to 3.3v