@@ -2359,6 +2359,36 @@ def __init__(self, pin, pull_up=False, bounce_time=1.00):
23592359MotionSensor .when_no_motion = MotionSensor .when_deactivated
23602360
23612361
2362+ class TouchSensor (Button ):
2363+ """
2364+ Represents a capacitive touch sensor (e.g. TTP223)
2365+
2366+ :param int pin:
2367+ The pin that the capacitive touch sensor is connected to.
2368+
2369+ :param bool pull_up:
2370+ If :data:`True`, the device will be pulled up to
2371+ HIGH. If :data:`False` (the default), the device will be pulled down to LOW.
2372+ Most capacitive touch sensors work with pull_up=False.
2373+
2374+ :param float bounce_time:
2375+ The bounce time for the device. If set, the device will ignore
2376+ any touch events that happen within the bounce time after a
2377+ touch event. This is useful to prevent false triggers from
2378+ electrical noise or multiple rapid touches.
2379+ Defaults to 0.02 seconds.
2380+ """
2381+
2382+ def __init__ (self , pin , pull_up = False , bounce_time = 0.02 ):
2383+ super ().__init__ (pin = pin , pull_up = pull_up , bounce_time = bounce_time )
2384+
2385+
2386+ TouchSensor .is_touched = TouchSensor .is_active
2387+ TouchSensor .is_not_touched = TouchSensor .is_inactive
2388+ TouchSensor .when_touch_starts = TouchSensor .when_activated
2389+ TouchSensor .when_touch_ends = TouchSensor .when_deactivated
2390+
2391+
23622392class AnalogInputDevice (InputDevice , PinMixin ):
23632393 """
23642394 Represents a generic input device with analogue functionality, e.g.
0 commit comments