Welcome¶
This documentation will guide you through the methods available in the Piano HAT python library.
Piano HAT is a musical Raspberry Pi add-on with 13 capacitive-touch piano keys plus octave and instrument select pads.
- More information - https://shop.pimoroni.com/products/piano-hat
- GPIO Pinout - http://pinout.xyz/pinout/piano_hat
- Get the code - https://github.com/pimoroni/piano-hat
- Get help - http://forums.pimoroni.com/c/support
At A Glance¶
Automatic LEDs¶
-
pianohat.
auto_leds
(enable=True)[source] Enable or disable automatic LEDs
Parameters: enable – enable or disable: True/False on automatic, the corresponding LED will light when a key is touched and turn off when it is released.
Get A Button State¶
-
pianohat.
get_state
(index=-1)[source] Get the state of a single key
Parameters: index – index of key to return, from 0 to 15
Instrument Button¶
-
pianohat.
on_instrument
(handler)[source] Register handler for press/release of instrument key
Parameters: handler – handler function to register See on_note for details.
Note¶
-
pianohat.
on_note
(handler)[source] Register handler for press/release of note key
Parameters: handler – handler function to register The handler function should expect two arguments.
The first is the button index that got the event, and the second is True for pressed and False for released.
Octave Down¶
-
pianohat.
on_octave_down
(handler)[source] Register handler for press/release of octave_down key
Parameters: handler – handler function to register See on_note for details.
Octave Up¶
-
pianohat.
on_octave_up
(handler)[source] Register handler for press/release of octave_up key
Parameters: handler – handler function to register See on_note for details.