Pin.Pull_X

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
KittehBit
Posts: 2
Joined: Mon Dec 04, 2017 9:00 pm

Pin.Pull_X

Post by KittehBit » Mon Dec 04, 2017 9:03 pm

Sorry if this is too simple,

but I cant find any information on that Pin.PULL_UP or PULL_DOWN do when I specify a pin.
The documentation said it defnies if a pull up or down resistor is... attached?
But what difference does that make in the code? Do I get a different voltage?

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Pin.Pull_X

Post by dhylands » Tue Dec 05, 2017 12:38 am

It controls whether the internal pull-up or pull-down resistor is enabled (the docs are perhaps missing the word 'internal')
http://docs.micropython.org/en/latest/p ... b.Pin.init

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

Re: Pin.Pull_X

Post by pythoncoder » Tue Dec 05, 2017 8:03 am

KittehBit wrote:
Mon Dec 04, 2017 9:03 pm
...Do I get a different voltage?
The usual use of internal pullup or pulldown resistors is to define the state of input pins which are unconnected. This is useful when connecting switches or pushbuttons. Without a pull, when the switch is open, the state of the pin is undefined: MOS inputs are very high impedance and can float to either level.

There is another use for a pullup with a pin configured as an open drain output, but this is rather more specialised.
Peter Hinch
Index to my micropython libraries.

KittehBit
Posts: 2
Joined: Mon Dec 04, 2017 9:00 pm

Re: Pin.Pull_X

Post by KittehBit » Tue Dec 05, 2017 9:48 am

So, meanwhile i read up on pull up resistors and what floating pins are. :)
So the chip has internal pull up resistors that i can just turn on in code? Neat :D

Thanks for the explanation!

Post Reply