File tree Expand file tree Collapse file tree 4 files changed +15
-50
lines changed Expand file tree Collapse file tree 4 files changed +15
-50
lines changed Original file line number Diff line number Diff line change @@ -101,18 +101,18 @@ Button
101101 :inherited-members:
102102 :members:
103103
104- TouchSensor
105- -----------
104+ Switch
105+ ------
106106
107- .. autoclass :: TouchSensor
107+ .. autoclass :: Switch
108108 :show-inheritance:
109109 :inherited-members:
110110 :members:
111111
112- Switch
113- ------
112+ TouchSensor
113+ -----------
114114
115- .. autoclass :: Switch
115+ .. autoclass :: TouchSensor
116116 :show-inheritance:
117117 :inherited-members:
118118 :members:
Original file line number Diff line number Diff line change 1- from picozero import TouchSensor
1+ from picozero import TouchSensor , LED
22from time import sleep
33
4+ # Capacitive touch sensor output connected to pin 2
45touch = TouchSensor (2 )
56
6- print ("Touch the sensor..." )
7+ # Built-in LED
8+ led = LED (25 )
79
810while True :
911 if touch .is_touched :
10- print ( "Touch detected!" )
12+ led . on ( )
1113 else :
12- print ( "No touch" )
14+ led . off ( )
1315 sleep (0.1 )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11from picozero import TouchSensor , LED
22from time import sleep
33
4- # Create a capacitive touch sensor on pin 2
4+ # Capacitive touch sensor output connected to pin 2
55touch = TouchSensor (2 )
66
7- # Create an LED on pin 25 (built -in LED)
7+ # Built -in LED
88led = LED (25 )
99
1010
@@ -25,4 +25,4 @@ def released():
2525 while True :
2626 sleep (1 )
2727except KeyboardInterrupt :
28- led .off () # Make sure LED is off when exiting
28+ led .off () # Turn LED off when exiting
You can’t perform that action at this time.
0 commit comments