Installation instructions can be found here
Detailed technical reference of the BCM2835 SOC and Raspberry Pi board can be found here
Wiki: Examples
Wiki: TechRef
Wiki: install
ChrisMartu
I am new to Raspberry Pi and python and I am trying to learn and understand the RPi.GPIO module but I was not able to locate a
List of (built-in) Functions
With description and syntax
Can somebody please point me in the right direction
Emmanuel ANDRE
Not sure if it helps but you can try this (non interactive) :
python -c 'import RPi.GPIO as GPIO; print(dir(GPIO))'
You will get a list of functions :
['BCM', 'BOARD', 'BOTH', 'FALLING', 'HARD_PWM', 'HIGH', 'I2C', 'IN', 'LOW', 'OUT', 'PUD_DOWN', 'PUD_OFF', 'PUD_UP', 'PWM', 'RISING', 'RPI_INFO', 'RPI_REVISION', 'SERIAL', 'SPI', 'UNKNOWN', 'VERSION', 'builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'path', 'spec', 'add_event_callback', 'add_event_detect', 'cleanup', 'event_detected', 'getmode', 'gpio_function', 'input', 'output', 'remove_event_detect', 'setmode', 'setup', 'setwarnings', 'wait_for_edge']
you can test the capital ones like this :
python -c 'import RPi.GPIO as GPIO; print(GPIO.VERSION)'
0.7.1a3
ChrisMartu
Thank you Emmanuel
Kobra
I just get that this cant be installed on my windows system even thought I just want to have it install so I can do coding on my windows system and known that it will work for my PI systems
Ken Brooks
I tried the standard install command on my apple silicon macintosh. It didn't work because a header file called sys/epoll.h is missing from the system.A little research suggests that this header file belongs to Linux, not clear that it belongs to Macintosh. Here's the full output:
%pipinstallRPi.GPIO
CollectingRPi.GPIO
DownloadingRPi.GPIO-0.7.1.tar.gz(29kB)
Preparingmetadata(setup.py)...done
Buildingwheelsforcollectedpackages:RPi.GPIO
BuildingwheelforRPi.GPIO(setup.py)...error
error:subprocess-exited-with-error
×ばつpythonsetup.pybdist_wheeldidnotrunsuccessfully.
│exitcode:1
╰─>[37linesofoutput]
runningbdist_wheel
runningbuild
runningbuild_py
creatingbuild
creatingbuild/lib.macosx-10.9-universal2-cpython-312
creatingbuild/lib.macosx-10.9-universal2-cpython-312/RPi
copyingRPi/__init__.py->build/lib.macosx-10.9-universal2-cpython-312/RPi
creatingbuild/lib.macosx-10.9-universal2-cpython-312/RPi/GPIO
copyingRPi/GPIO/__init__.py->build/lib.macosx-10.9-universal2-cpython-312/RPi/GPIO
runningbuild_ext
building'RPi._GPIO'extension
creatingbuild/temp.macosx-10.9-universal2-cpython-312
creatingbuild/temp.macosx-10.9-universal2-cpython-312/source
clang-fno-strict-overflow-Wsign-compare-Wunreachable-code-fno-common-dynamic-DNDEBUG-g-O3-Wall-archarm64-archx86_64-g-I/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12-csource/c_gpio.c-obuild/temp.macosx-10.9-universal2-cpython-312/source/c_gpio.o
source/c_gpio.c:170:9:warning:casttosmallerintegertype'uint32_t'(aka'unsigned int')from'uint8_t *'(aka'unsigned char *')[-Wpointer-to-int-cast]
if((uint32_t)gpio_mem%PAGE_SIZE)
^~~~~~~~~~~~~~~~~~
source/c_gpio.c:171:34:warning:casttosmallerintegertype'uint32_t'(aka'unsigned int')from'uint8_t *'(aka'unsigned char *')[-Wpointer-to-int-cast]
gpio_mem+=PAGE_SIZE-((uint32_t)gpio_mem%PAGE_SIZE);
^~~~~~~~~~~~~~~~~~
2warningsgenerated.
source/c_gpio.c:170:9:warning:casttosmallerintegertype'uint32_t'(aka'unsigned int')from'uint8_t *'(aka'unsigned char *')[-Wpointer-to-int-cast]
if((uint32_t)gpio_mem%PAGE_SIZE)
^~~~~~~~~~~~~~~~~~
source/c_gpio.c:171:34:warning:casttosmallerintegertype'uint32_t'(aka'unsigned int')from'uint8_t *'(aka'unsigned char *')[-Wpointer-to-int-cast]
gpio_mem+=PAGE_SIZE-((uint32_t)gpio_mem%PAGE_SIZE);
^~~~~~~~~~~~~~~~~~
2warningsgenerated.
clang-fno-strict-overflow-Wsign-compare-Wunreachable-code-fno-common-dynamic-DNDEBUG-g-O3-Wall-archarm64-archx86_64-g-I/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12-csource/common.c-obuild/temp.macosx-10.9-universal2-cpython-312/source/common.o
clang-fno-strict-overflow-Wsign-compare-Wunreachable-code-fno-common-dynamic-DNDEBUG-g-O3-Wall-archarm64-archx86_64-g-I/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12-csource/constants.c-obuild/temp.macosx-10.9-universal2-cpython-312/source/constants.o
clang-fno-strict-overflow-Wsign-compare-Wunreachable-code-fno-common-dynamic-DNDEBUG-g-O3-Wall-archarm64-archx86_64-g-I/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12-csource/cpuinfo.c-obuild/temp.macosx-10.9-universal2-cpython-312/source/cpuinfo.o
clang-fno-strict-overflow-Wsign-compare-Wunreachable-code-fno-common-dynamic-DNDEBUG-g-O3-Wall-archarm64-archx86_64-g-I/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12-csource/event_gpio.c-obuild/temp.macosx-10.9-universal2-cpython-312/source/event_gpio.o
source/event_gpio.c:24:10:fatalerror:'sys/epoll.h'filenotfound
#include <sys/epoll.h>
^~~~~~~~~~~~~
1errorgenerated.
error:command'/usr/bin/clang'failedwithexitcode1
[endofoutput]
note:Thiserrororiginatesfromasubprocess,andislikelynotaproblemwithpip.
ERROR:FailedbuildingwheelforRPi.GPIO
Runningsetup.pycleanforRPi.GPIO
FailedtobuildRPi.GPIO
ERROR:CouldnotbuildwheelsforRPi.GPIO,whichisrequiredtoinstallpyproject.toml-basedprojects
[notice]Anewreleaseofpipisavailable:24.0->24.1.1
[notice]Toupdate,run:pip3install--upgradepip
%
Log in to post a comment.