alarm.touch – Trigger an alarm when touch is detected.

class alarm.touch.TouchAlarm(*pin: microcontroller.Pin)

Create an alarm that will be triggered when the given pin is touched. The alarm is not active until it is passed to an alarm-enabling function, such as alarm.light_sleep_until_alarms() or alarm.exit_and_deep_sleep_until_alarms().


pin (microcontroller.Pin) – The pin to monitor. On some ports, the choice of pin may be limited due to hardware restrictions, particularly for deep-sleep alarms.

Limitations: Not available on SAMD, nRF, or RP2040.

pin: microcontroller.Pin

The trigger pin.