Raspberry Pi GPIO input driver¶
Driver for buttons connected to GPIO. Up to 8 button are supported now. Sample config.json:
"input":
[{
"driver":"pi_gpio",
"kwargs":
{
"button_pins":[25, 24, 23, 18, 22, 27, 17, 4]
}
}]
-
class
input.drivers.pi_gpio.
InputDevice
(button_pins=[], pullups=True, **kwargs)[source]¶ A driver for pushbuttons attached to Raspberry Pi GPIO. It uses RPi.GPIO library. Button’s first pin has to be attached to ground, second pin has to be attached to the GPIO pin. Pullups are expected - by default, internal pullups of Raspberry Pi GPIO are enabled. If internal pullups are not desired, supply “pullups”:false in config.json and provide your own pullups.
-
__init__
(button_pins=[], pullups=True, **kwargs)[source]¶ Initialises the
InputDevice
object.Kwargs:
button_pins
: GPIO numbers which to treat as buttons (GPIO.BCM numbering)pullups
: if True, enables pullups on all pins, if False, doesn’t. Default: Truedebug
: enables printing button press and release events when set to True
-