| | |
- add_event_callback(channel, callback)
- Add a callback for an event already defined using add_event_detect()
channel - either board pin number or BCM number depending on which mode is set.
callback - a callback function
- add_event_detect(channel, edge, callback, bouncetime)
- Enable edge detection events for a particular GPIO channel.
channel - either board pin number or BCM number depending on which mode is set.
edge - RISING, FALLING or BOTH
[callback] - A callback function for the event (optional)
[bouncetime] - Switch bounce timeout in ms for callback
- cleanup(channel=None)
- Clean up by resetting all GPIO channels that have been used by this program to INPUT with no pullup/pulldown and no event detection
[channel] - individual channel or list/tuple of channels to clean up. Default - clean every channel that has been used.
- event_detected(channel)
- Returns True if an edge has occurred on a given GPIO. You need to enable edge detection using add_event_detect() first.
channel - either board pin number or BCM number depending on which mode is set.
- getmode()
- Get numbering mode used for channel numbers.
Returns BOARD, BCM or None
- gpio_function(channel)
- Return the current GPIO function (IN, OUT, PWM, SERIAL, I2C, SPI)
channel - either board pin number or BCM number depending on which mode is set.
- input(channel)
- Input from a GPIO channel. Returns HIGH=1=True or LOW=0=False
channel - either board pin number or BCM number depending on which mode is set.
- output(channel, value)
- Output to a GPIO channel or list of channels
channel - either board pin number or BCM number depending on which mode is set.
value - 0/1 or False/True or LOW/HIGH
- remove_event_detect(channel)
- Remove edge detection for a particular GPIO channel
channel - either board pin number or BCM number depending on which mode is set.
- setmode(mode)
- Set up numbering mode to use for channels.
BOARD - Use Raspberry Pi board numbers
BCM - Use Broadcom GPIO 00..nn numbers
- setup(channel, direction, initial=0, pull_up_down=20)
- Set up a GPIO channel or list of channels with a direction and (optional) pull/up down control
channel - either board pin number or BCM number depending on which mode is set.
direction - IN or OUT
[pull_up_down] - PUD_OFF (default), PUD_UP or PUD_DOWN
[initial] - Initial value for an output channel
- setwarnings(flag)
- Enable or disable warning messages
- wait_for_edge(channel, edge, bouncetime, timeout)
- 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
|