Hi everyone!
In my ESP8266 project, I have used all available GPIO pins. Is it possible to use the analog pin A0 to control a relay? I have read somewhere that this pin supports digitalWrite. Is it possible to do that in MicroPython?
Thank you!
Using the analog pin to control a relay?
Re: Using the analog pin to control a relay?
It doesn't and it's not possible.
Re: Using the analog pin to control a relay?
But you can use it as a slow input, polled by software, like for a switch.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Using the analog pin to control a relay?
@Roberthh I think you may have misunderstood the original post. @digicosmos wants to re-purpose the pin as a digital output. I believe @deshipu is correct in his comment and that it's a limitation of the hardware rather than of MicroPython.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Using the analog pin to control a relay?
No, I did not misunderstand. My comment was, that if the poster has another digital pin, used as slow input, he/she could swap that with the analog pin. I did that once when I ran out of pins on a ESP8266. I used is for a "operation mode" switch.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Using the analog pin to control a relay?
Fair point, although a pair of resistors should be used to limit the digital signal to the 0-1V that the ADC can accept.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
-
- Posts: 3
- Joined: Fri Mar 16, 2018 2:02 pm
Re: Using the analog pin to control a relay?
Thank you too you all!