I am trying to set up a GPIO pin to look for pin 5 to go from low to high.
in the tutorial http://docs.micropython.org/en/latest/e ... /pins.html it says:
"To make an input pin use:
[code]
>>> pin = machine.Pin(0, machine.Pin.OUT, machine.Pin.PULL_UP)
[/code]
You can either use PULL_UP or None for the input pull-mode. If it’s not specified then it defaults to None, which is no pull resistor."
None gives a syntax error - I think I read in the release notes that this is a known bug?
But in the QuickRef ( http://docs.micropython.org/en/latest/e ... s-and-gpio )it says to use
[code]
p2 = Pin(2, Pin.IN) # create input pin on GPIO2
[/code]
Thinking the tutorial is outdated or a typo I have been using the QuickRef, however the pin always returns high, even without hardware attached. Should I be using the other one?
Thanks!
GPIO input pin questions
Re: GPIO input pin questions
Using machine.Pin.OUT will definitely not make the pin an input. That's a bug in the documentation.
Re: GPIO input pin questions
There is another issue. Pins GPIO2, GPIO0 and GPIO15 are used to select the boot mode for ESP8266, and if you are using a development board, they probably have external pull-up or pull-down resistors in there, to make sure the board boots properly.
Re: GPIO input pin questions
I am using pin 5 as the input. I may try an external 10k pull down resistor in hardware to see if it is just floating and going to rail.
Datasheet for the -12 says High starts as .75 v?
Sent from my SM-G930V using Tapatalk
Datasheet for the -12 says High starts as .75 v?
Sent from my SM-G930V using Tapatalk
Re: GPIO input pin questions
For reference, the WeMos D1 mini dev board has the following configuration:
GPIO0 -> 10k -> 3V3
GPIO2 -> 10k -> 3V3
GPIO15 -> 10k -> GND
GPIO0 -> 10k -> 3V3
GPIO2 -> 10k -> 3V3
GPIO15 -> 10k -> GND