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 and pulled up to 3.3V with a 1-10K resistor. It’s also possible to use internal pullups of Raspberry Pi GPIO.
-
__init__
(button_pins=[], pullups=True, **kwargs)[source]¶ Initialises the
InputDevice
object.Kwargs:
button_pins
: GPIO mubers 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
-