File tree Expand file tree Collapse file tree 5 files changed +71
-1
lines changed
Adafruit_Feather_TFT_ESP32-S2/storage
analog_voltage_values_ESP32-S2
cap_touch_one_pin_ESP32-S2
cap_touch_two_pins_ESP32-S2
digital_input_built_in_button_led Expand file tree Collapse file tree 5 files changed +71
-1
lines changed Original file line number Diff line number Diff line change 1-
21# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
32# SPDX-License-Identifier: MIT
43"""
Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: 2022 Kattni Rembor for Adafruit Industries
2+ # SPDX-License-Identifier: MIT
3+ """CircuitPython Analog In Voltage Example for ESP32-S2"""
4+ import time
5+ import board
6+ import analogio
7+
8+ analog_pin = analogio .AnalogIn (board .A0 )
9+
10+
11+ def get_voltage (pin ):
12+ return (pin .value * 2.57 ) / 51000
13+
14+
15+ while True :
16+ print (get_voltage (analog_pin ))
17+ time .sleep (0.1 )
Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
2+ # SPDX-License-Identifier: MIT
3+ """
4+ CircuitPython Capacitive Touch Pin Example for ESP32-S2.
5+ Print to the serial console when one pin is touched.
6+ """
7+ import time
8+ import board
9+ import touchio
10+
11+ touch = touchio .TouchIn (board .D8 )
12+
13+ while True :
14+ if touch .value :
15+ print ("Pin touched!" )
16+ time .sleep (0.1 )
Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
2+ # SPDX-License-Identifier: MIT
3+ """
4+ CircuitPython Capacitive Two Touch Pin Example for ESP32-S2
5+ Print to the serial console when a pin is touched.
6+ """
7+ import time
8+ import board
9+ import touchio
10+
11+ touch_one = touchio .TouchIn (board .D8 )
12+ touch_two = touchio .TouchIn (board .D5 )
13+
14+ while True :
15+ if touch_one .value :
16+ print ("Pin one touched!" )
17+ if touch_two .value :
18+ print ("Pin two touched!" )
19+ time .sleep (0.1 )
Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: 2022 Kattni Rembor for Adafruit Industries
2+ # SPDX-License-Identifier: MIT
3+ """
4+ CircuitPython Digital Input Example - Blinking an LED using the built-in button.
5+ """
6+ import board
7+ import digitalio
8+
9+ led = digitalio .DigitalInOut (board .LED )
10+ led .direction = digitalio .Direction .OUTPUT
11+
12+ button = digitalio .DigitalInOut (board .BUTTON )
13+ button .switch_to_input (pull = digitalio .Pull .UP )
14+
15+ while True :
16+ if not button .value :
17+ led .value = True
18+ else :
19+ led .value = False
You can’t perform that action at this time.
0 commit comments