- Tue Nov 09, 2021 7:00 pm
#92799
array81 wrote:Good Science For You wrote:You want a pull up pin on startup.
D3 IO, 10k Pull-up GPIO0
D4 IO, 10k Pull-up, BUILTIN_LED GPIO2
Also in the setup() set the pin to HIGH to start.
digitalWrite(pin, HIGH);
Then change to LOW as needed in the main loop.
Thanks for your replay.
I just use D3 and D4 to control my relay and I set digitalWrite(pin, HIGH); on setup but this not works. I relay is active for a fraction of a second on device start. After this all work.
I have read on other forum that for this scope is not possible use the internal pull-down resitor but I need add an external (I don't know why, maybe the resistance is too small) but I don't understand the scheme. I just have use pull-down resister for button but not with relay. I need connect PIN with GND by resister before relay?
You cannot use a pull-down resistor on D3 or D4 as both pins must be high to boot into the normal program. Pulling pin D3 (GPIO0) will put the d1 mini into flash mode.
If you used D1, D2, D5, D6 or D7 instead you will not get the momentary trip of your relay when your board boots because those pins will be high at boot. You also can't use D8 because that pin has a built-in pull-down and boot will fail if that pin is pulled high, which it would be if you connected your relay board (the signal pin from the board is high and your esp board pulls it low to turn it the relay "on".