AnswerBun.com

Is there documentation for RPi.GPIO

Raspberry Pi Asked by Milliways on October 15, 2020

Is there documentation for RPi.GPIO? I have searched the web and can’t find anything.

I know I can use pydoc or help() but this produces the following:-

wait_for_edge(...)
    Wait for an edge.  Returns the channel number or None on timeout.
    channel      - either board pin number or BCM number depending on which mode is set.
    edge         - RISING, FALLING or BOTH
    [bouncetime] - time allowed between calls to allow for switchbounce
    [timeout]    - timeout in ms

This is OK, in as far as it goes, but doesn’t really explain.
I assume the function blocks until the interrupt, but this is not stated.
What are the limits/defaults for timeout?

I have the following code, which I start on boot. Pressing the button successfully shuts down, but I have noticed it also seems to shut down at other times.

I could add some code to verify the button push, or some circuitry to make it more robust, but though I would check the documentation first.

while True:
    # set an interrupt on a falling edge and wait for it to happen
    GPIO.wait_for_edge(INT, GPIO.FALLING)

    subprocess.call(['poweroff'], shell=True, 
        stdout=subprocess.PIPE, stderr=subprocess.PIPE)

Edit 2016-01-03


I downloaded the source from SourceForge, which made things somewhat clearer, but the timeout parameter seems to be missing in action.

2 Answers

The official documentation is http://sourceforge.net/p/raspberry-gpio-python/wiki/Examples/

It doesn't seem to have a traditional API style of documentation.

Correct answer by joan on October 15, 2020

I have finally found a Python library with documentation gpiozero

I recommend this to anyone attempting to manipulate GPIO with Python.

Just to clarify I also highly recommend the pigpio Python module which has more functionality.

Answered by Milliways on October 15, 2020

Add your own answers!

Related Questions

Can’t mount Raspberry Pi NFS Server

3  Asked on January 6, 2022

   

Trying to set up a RasPi 3A, it does nothing on boot

0  Asked on January 6, 2022 by the-candy-king

 

Send uart commands through bluetooth

2  Asked on January 4, 2022 by michaelangelo

   

How to Debug Bootloader (u-boot) and linux kernel in Raspberry PI

1  Asked on January 4, 2022 by abdul-rahuman-seeni-mohamed

 

Is PiFace Digital 2 compatible with Raspberry Pi Zero W rev 1.1?

1  Asked on January 4, 2022 by marie-schreiber

     

How to replace SD card slot on Raspberry Pi 4?

1  Asked on January 4, 2022 by karsten-jensen

     

raspberry pi access point status

1  Asked on January 4, 2022 by aayush-lakkad

         

Pi 3 wifi access point

1  Asked on January 2, 2022 by neilk

 

Enable desktop on the raspberry pi

0  Asked on January 2, 2022 by dicoy

     

Pi Zero W Bluetooth Connection Getting Dropped

1  Asked on December 31, 2021 by mark-estrada

   

32 and 64 bit usage

0  Asked on December 31, 2021

   

New Password not Being Accepted

1  Asked on December 31, 2021 by alanf

   

Pi 3 B+, 7″ official touch screen and a Sense Hat query

1  Asked on December 28, 2021 by phil-c

 

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP