Skip to content

Commit 0090edd

Browse files
authored
Merge pull request #2185 from adafruit/qtPyS3
adding examples for qt py s3
2 parents 591cdb7 + 19cf0a3 commit 0090edd

File tree

5 files changed

+93
-0
lines changed

5 files changed

+93
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# SPDX-FileCopyrightText: 2022 Liz Clark for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
"""CircuitPython Analog In Voltage Example for ESP32-S3"""
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 * 3.53) / 61285
13+
14+
15+
while True:
16+
print(get_voltage(analog_pin))
17+
time.sleep(0.1)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# SPDX-FileCopyrightText: 2022 Liz Clark for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
"""
4+
CircuitPython Capacitive Touch Pin Example for ESP32-S3.
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.A2)
12+
13+
while True:
14+
if touch.value:
15+
print("Pin touched!")
16+
time.sleep(0.1)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-FileCopyrightText: 2022 Liz Clark for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
"""
4+
CircuitPython Capacitive Two Touch Pin Example for ESP32-S3
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.A2)
12+
touch_two = touchio.TouchIn(board.TX)
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)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
"""
4+
CircuitPython Digital Input example - Blinking a built-in NeoPixel LED using a button switch.
5+
"""
6+
import board
7+
import digitalio
8+
import neopixel
9+
10+
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)
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+
pixel.fill((255, 0, 0))
18+
else:
19+
pixel.fill((0, 0, 0))
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
"""
4+
CircuitPython Essentials Storage CP Filesystem boot.py file
5+
"""
6+
import time
7+
import board
8+
import digitalio
9+
import storage
10+
import neopixel
11+
12+
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)
13+
14+
button = digitalio.DigitalInOut(board.BUTTON)
15+
button.switch_to_input(pull=digitalio.Pull.UP)
16+
17+
# Turn the NeoPixel blue for one second to indicate when to press the boot button.
18+
pixel.fill((255, 255, 255))
19+
time.sleep(1)
20+
21+
# If the button is connected to ground, the filesystem is writable by CircuitPython
22+
storage.remount("/", readonly=button.value)

0 commit comments

Comments
 (0)