Welcome¶
This documentation will guide you through the methods available in the Touch pHAT python library.
- More information - https://shop.pimoroni.com/products/touch-phat
- GPIO Pinout - http://pinout.xyz/pinout/touch_phat
- Get the code - https://github.com/pimoroni/touch-phat
- Get help - http://forums.pimoroni.com/c/support
At A Glance¶
Turn On A Light¶
-
touchphat.
led_on
(pad)[source] Turn on an LED corresponding to a single pad.
Parameters: pad – A single integer from 0 to 5 or a pad name (Back, A, B, C, D, Enter), corresponding to the pad whose LED you want to turn on.
Turn Off A Light¶
-
touchphat.
led_off
(pad)[source] Turn off an LED corresponding to a single pad.
Parameters: pad – A single integer from 0 to 5 or a pad name (Back, A, B, C, D, Enter), corresponding to the pad whose LED you want to turn off.
Detect A Touch¶
-
touchphat.
on_touch
(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 0 to 5, a pad name (Back, A, B, C, D, Enter), or a list
- handler – The handler function to call on hit
Detect A Release¶
-
touchphat.
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 5, a pad name (Back, A, B, C, D, Enter), or a list
- handler – The handler function to call on release