hi there
I am try to pull down pin, but get error:
File "main.py", line 17, in <module>
File "button.py", line 32, in __init__
AttributeError: type object 'Pin' has no attribute 'PULL_DOWN'
MicroPython v1.10-8-g8b7039d7d on 2019-01-26; ESP module with ESP8266
line 32
[code]
self.__btn_pin = Pin(btn_pin, Pin.IN, pull=Pin.PULL_DOWN)
[/code]
btn_pin = 0
in REPL
>>> from machine import Pin
>>> dir(Pin)
['__class__', '__name__', 'IN', 'IRQ_FALLING', 'IRQ_RISING', 'OPEN_DRAIN', 'OUT', 'PULL_UP', 'init', 'irq', 'off', 'on', 'value']
there are no define PULL_DOWN, LOW_POWER, IRQ_LOW_LEVEL and etc in class Pin but is in documentation.
How i can pull down pin?
board: WEMOS D1 mini
'Pin' has no attribute 'PULL_DOWN' ?
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: 'Pin' has no attribute 'PULL_DOWN' ?
Perhaps this in unsupported in the hardware. In which case you'll need an external resistor.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.