-1

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));
}

Any reason this is happening? Grounds are connected. Simply trying to turn LED on/off if external voltage occurs at any GPIO pin (e.g., 26).

6
  • 2
    are you saying that you are attempting to power one ESP32 from the GPIO pin of another ESP32? Commented Feb 23, 2021 at 18:30
  • 1
    Have you connected the GND pins of the two ESP? Commented Feb 23, 2021 at 18:57
  • @jsotola .....no Commented Feb 23, 2021 at 19:42
  • @PeterPaulKiefer yes Commented Feb 23, 2021 at 19:42
  • you have a serial.println() statement in your code ... please add the resuling printout to your post Commented Feb 23, 2021 at 21:54

1 Answer 1

0

Arduino GPIO automatically set as inputs, so I assumed the same for ESP32. Once the pinMode of the input pin was set, it worked:

#define LED 2 // ON Board LED GPIO 2
#define inPin 26

void setup()
{
  Serial.begin(9600);
  // Pins 34, 35, 36, 39 are input only
  pinMode(LED, OUTPUT);
  pinMode(inPin, INPUT); // <----------
}

void loop()
{
  Serial.println(digitalRead(inPin));
  digitalWrite(LED, digitalRead(inPin));
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.