-
Notifications
You must be signed in to change notification settings - Fork 25
Function Definitions
GPIO.setmode(mode)
Sets the desired GPIO mode.
Argument | Options |
---|---|
mode |
ROCK , BOARD , BCM
|
GPIO.getmode()
Returns the current GPIO mode in the form of ROCK
, BOARD
, or BCM
GPIO.gpio_function(channel)
Returns the current function of a GPIO export in the form of GPIO.INPUT
, GPIO.OUTPUT
, or GPIO.UNKNOWN
.
Argument | Options |
---|---|
channel |
ROCK , BOARD , or BCM number |
GPIO.setwarnings(state)
Sets the desired warning mode.
Argument | Options |
---|---|
state |
True , False
|
GPIO.setup(channel, direction, pull_up_down, initial)
Configures a new GPIO export.
Argument | Options |
---|---|
channel |
ROCK , BOARD , or BCM numberNote: To setup multiple channels, send multiple values, e.g. [14, 15]
|
direction |
GPIO.IN , GPIO.OUT
|
pull_up_down |
GPIO.PUD_DOWN (default), GPIO.PUD_UP
|
initial |
GPIO.LOW (default), GPIO.HIGH Note: If multiple channels, accepts multiple values, e.g. [GPIO.LOW, GPIO.HIGH]
|
GPIO.output(channel, value)
Sets the output state of a GPIO export.
Argument | Options |
---|---|
channel |
ROCK , BOARD , or BCM numberNote: To output to multiple channels, send multiple values, e.g. [14, 15]
|
value |
GPIO.LOW , GPIO.HIGH Note: If multiple channels, accepts multiple values, e.g. [GPIO.LOW, GPIO.HIGH]
|
GPIO.input(channel)
Returns the current state of a GPIO export.
Argument | Options |
---|---|
channel |
ROCK , BOARD , or BCM number |
GPIO.cleanup(channel)
Cleans up the specified GPIO export. If no channel is specified, cleans up all GPIO exports.
Argument | Options |
---|---|
channel |
ROCK , BOARD , or BCM numberNote: To cleanup multiple channels, send multiple values, e.g. [14, 15]
|
p=GPIO.PWM(channel, frequency)
Creates a new PWM object "p"
Argument | Options |
---|---|
channel |
ROCK , BOARD , or BCM number |
p.start(dutycycle, pwm_precision)
Starts the background process "p", with desired duty cycle and precision
Argument | Options |
---|---|
dutycycle |
Number between 1 and 100 (%) |
pwm_precision |
GPIO.HIGH (default), GPIO.LOW
|
p.stop()
Stops the background process "p"
p.ChangeFrequency(frequency)
Change the frequency of "p"
Argument | Options |
---|---|
frequency |
Number (Hz) |
p.ChangeDutyCycle(dutycycle)
Change the duty cycle of "p"
Argument | Options |
---|---|
dutycycle |
Number between 1 and 100 (%) |
GPIO.wait_for_edge(channel, edge, bouncetime, timeout)
Pause execution until the desired interrupt is triggered.
Argument | Options |
---|---|
channel |
ROCK , BOARD , or BCM number |
edge |
GPIO.RISING , GPIO.FALLING , GPIO.BOTH
|
bouncetime |
Debounce time in milliseconds (optional) |
timeout |
Timeout in milliseconds (optional) |
GPIO.event_detected()
Not yet implemented.
GPIO.add_event_detect()
Not yet implemented.
GPIO.add_event_callback()
Not yet implemented.
GPIO.remove_event_detect()
Not yet implemented.