GPIO state on Pin.OUT initialization
Posted: Sat Jul 18, 2020 10:44 pm
Hello all,
First and foremost please excuse for the trivial question - I did use google but apparently I'm not finding the appropriate keywords to find my answer. I'm not native English and completely new to microcontrollers.
My issue is that whenever I initialize a pin as output after boot, like the pin will change state. I am not talking about boot state, which I found some borderline relevant hits for (but not for micropython either), but specifically after this initialization.
I could play around and not initialize pins until the 1st time I want them switched on (or even flip the GPIO value right after its init (which will blink the led on the relay, but will not yet cause the the relay to be toggled - not an optimal solution), but I would like to know if there is a better, tried and tested solution for this.
On my raspberry I did not face such issues, there are some GPIOs that come up high on boot, but again, in the case of ESP32 am not talking strictly about boot, I am taking about pin state when setting the pin to out mode.
Thanks - and sorry for the trivial question.
First and foremost please excuse for the trivial question - I did use google but apparently I'm not finding the appropriate keywords to find my answer. I'm not native English and completely new to microcontrollers.
My issue is that whenever I initialize a pin as output after boot, like
Code: Select all
relay = Pin(15, Pin.OUT)
I could play around and not initialize pins until the 1st time I want them switched on (or even flip the GPIO value right after its init (which will blink the led on the relay, but will not yet cause the the relay to be toggled - not an optimal solution), but I would like to know if there is a better, tried and tested solution for this.
On my raspberry I did not face such issues, there are some GPIOs that come up high on boot, but again, in the case of ESP32 am not talking strictly about boot, I am taking about pin state when setting the pin to out mode.
Thanks - and sorry for the trivial question.