blikkk
August 15, 2021, 12:00pm
1
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.
blikkk
August 15, 2021, 12:21pm
3
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.
blikkk
August 15, 2021, 12:29pm
5
WeMos D1 mini. It does not read the output.
Not all processors have a read-back latch on the I/O.
blikkk
August 15, 2021, 12:35pm
7
It worked until yesterday.
Then re-install the factory firmware, as I suggested.
blikkk
August 15, 2021, 12:42pm
9
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.
6v6gt
August 15, 2021, 12:52pm
12
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".
6v6gt
August 15, 2021, 4:28pm
14
OK. That is more or less clear now but the behaviour of reading an OUTPUT pin can be platform dependent:
opened 07:56PM - 31 Aug 17 UTC
All Arduino / open source variants I have tested (ATMEGA328, ATMEGA2560, ATSAM3X… 8E, SAMD, Curie, ESP8266, ATSAMD21, ESP32) will properly report an output pin's state via digitalRead();. The nrf52 based Primo does not correctly report unless the pin has been declared an input first. Example:
```
boolean oneshot = false;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
Serial.println(digitalRead(LED_BUILTIN));
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
Serial.println(digitalRead(LED_BUILTIN));
if ((millis() > 15000) && !oneshot)
{
pinMode(LED_BUILTIN, INPUT);
delay(200);
pinMode(LED_BUILTIN, OUTPUT);
oneshot = true;
}
}
```
However, in the case of the ESP8266, it should work (by now).
blikkk
August 16, 2021, 8:41am
15
The low value of the series resistance caused the fault.
Thanks to everyone for their help.
system
Closed
December 14, 2021, 8:41am
16
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.