'Pin' has no attribute 'PULL_DOWN' ?

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
Migele
Posts: 1
Joined: Wed Mar 13, 2019 6:53 am

'Pin' has no attribute 'PULL_DOWN' ?

Post by Migele » Wed Mar 13, 2019 8:03 am

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

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: 'Pin' has no attribute 'PULL_DOWN' ?

Post by pythoncoder » Wed Mar 13, 2019 8:38 am

Perhaps this in unsupported in the hardware. In which case you'll need an external resistor.
Peter Hinch
Index to my micropython libraries.

Post Reply