in order to access the GPIO lines using the pypi.GPIO module, I need to 'run the script' as root.
So I startx to go into the gui (perhaps thats the first mistake?), open a terminal and type
suso su -
to enter root. Then I have typed the following :
Python 2.6.6 (r266:84292, Dec 27 2010, 21:57:32)
[GCC 4.4.5 20100902 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import RPi.GPIO as GPIO
>>> GPIO.setup(17, GPIO.OUT)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/RPi.GPIO-0.2.0-py2.6.egg/RPi/GPIO/__init__.py", line 92, in setup
id = _GetValidId(channel)
File "/usr/local/lib/python2.6/dist-packages/RPi.GPIO-0.2.0-py2.6.egg/RPi/GPIO/__init__.py", line 82, in _GetValidId
so as you can see, the import function is accepted, but it doesn' like the setup command.
What am I doing wrong?
What I am trying to do is switch on a LED on GPIO-0 (bcm 17). I can do it from the shell using
echo "17" > /sys/class/gpio/output
but not from python.
Do I have to create the python program using an editor first and then run it?
Any help welcome,
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):