Welcome¶
This documentation will guide you through the methods available in the Drum HAT python library.
Drum HAT is a musical Raspberry Pi add-on with 8 capacitive-touch drum pads.
- More information - https://shop.pimoroni.com/products/drum-hat
- GPIO Pinout - http://pinout.xyz/pinout/drum_hat
- Get the code - https://github.com/pimoroni/drum-hat
- Get help - http://forums.pimoroni.com/c/support
At A Glance¶
Turn On A Light¶
-
drumhat.
led_on
(pad)[source] Turn on an LED corresponding to a single pad.
Parameters: pad – A single integer from 0 to 7, corresponding to the pad whose LED you want to turn on.
Turn Off A Light¶
-
drumhat.
led_off
(pad)[source] Turn off an LED corresponding to a single pad.
Parameters: pad – A single integer from 0 to 7, corresponding to the pad whose LED you want to turn off.
Detect A Hit¶
-
drumhat.
on_hit
(pad, handler=None)[source] Register a function to be called when a pad or pads are hit.
The function should expect one argument: event. You can look at event.pad to determine which pad was hit.
Parameters: - pad – A single integer from 0 to 7, or a list of integers
- handler – The handler function to call on hit
Detect A Release¶
-
drumhat.
on_release
(pad, handler=None)[source] Register a function to be called when a pad or pads are released.
The function should expect one argument: event. You can look at event.pad to determine which pad was released.
Parameters: - pad – A single integer from 0 to 7, or a list of integers
- handler – The handler function to call on release