Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPi Zero internal pullup/down error #24

Closed
OperatorB opened this issue Feb 11, 2018 · 4 comments
Closed

OPi Zero internal pullup/down error #24

OperatorB opened this issue Feb 11, 2018 · 4 comments

Comments

@OperatorB
Copy link

OperatorB commented Feb 11, 2018

Hi!
After a recent OS (dietpi) and firmware update on my OPi Zero, my python code stopped working. I found that the problem is around "GPIO.setup(..., pull_up_down=GPIO.PUD_UP)".
When I run the code it spits out "AttributeError: 'module' object has no attribute 'PUD_UP' ".
Probably I screwed up something but I could not figure out what.

my code:

#!/usr/bin/python
import OPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(11,GPIO.IN,pull_up_down=GPIO.PUD_UP)

when run with ./mycode.py it replies:

Traceback (most recent call last):
  File "./test.py", line 6, in <module>
    GPIO.setup(11,GPIO.IN,pull_up_down=GPIO.PUD_UP)
AttributeError: 'module' object has no attribute 'PUD_UP'

Thanks for reading ;)

@rm-hull
Copy link
Owner

rm-hull commented Feb 12, 2018

If you do pip list | grep -i gpio on the command-line what does it show?

@OperatorB
Copy link
Author

It replied:

DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
OPi.GPIO (0.3.1)

@rm-hull
Copy link
Owner

rm-hull commented Feb 12, 2018

Ok, so you have the latest version. But you know that pull-up/down is not yet supported? See #9

However GPIO.PUD_UP should exist.

What version of python are you using?

@OperatorB
Copy link
Author

All right, so there was no issue with it before the 'new' OPi firmware. Ok, thank you for the intel.

I'm using Python 2.7 (but 3.5 is installed as well). I will add externally a resistor then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants