ESP8266 GPIO problem

Hi!

int a;

void setup() {
  Serial.begin(57600);
  Serial.println();
  Serial.println();
  pinMode(5, OUTPUT);
  digitalWrite(5,HIGH);
  a = digitalRead(5);
  Serial.println(a);
}

void loop() {
}

13:58:29.036 ->
13:58:29.036 -> 0

Led is lit.

???????????

It's easier to troubleshoot if it's lit, than if it's not lit.

I tried this firmware.
I full erase board.
After not work.

You didn't say what is your problem... or anything about your system. There are probably almost 1000 different ESP8266 systems out there...

If you have a firmware problem, re-install the factory firmware.

WeMos D1 mini. It does not read the output.

Not all processors have a read-back latch on the I/O.

It worked until yesterday.

Then re-install the factory firmware, as I suggested.

This solution is likely.
Has anyone ever done this?

Yes, at least once... at the factory. Espressif publishes instructions on how to do it. Oh wait, you already know how. Factory firmware images are available on Espressif website.

I checked, it’s ok. my Led is on too.

How is the led wired? High side or Low side ?

OP is not complaining about the LED. It's about the readback, expects a "1" not a "0".

OK. That is more or less clear now but the behaviour of reading an OUTPUT pin can be platform dependent:

However, in the case of the ESP8266, it should work (by now).

The low value of the series resistance caused the fault.
Thanks to everyone for their help.

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