Skip to content

Commit 0c1bb71

Browse files
committed
TFT Feather template code and license updates.
1 parent b415fea commit 0c1bb71

File tree

42 files changed

+166
-36
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+166
-36
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# SPDX-FileCopyrightText: 2022 Kattni Rembor for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
"""CircuitPython Analog In Voltage Example"""
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.64) / 52507
13+
14+
15+
while True:
16+
print(get_voltage(analog_pin))
17+
time.sleep(0.1)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
"""
4+
CircuitPython Capacitive Touch Pin Example - Print to the serial console when one pin is touched.
5+
"""
6+
import time
7+
import board
8+
import touchio
9+
10+
touch = touchio.TouchIn(board.A5)
11+
12+
while True:
13+
if touch.value:
14+
print("Pin touched!")
15+
time.sleep(0.1)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
"""
4+
CircuitPython Capacitive Two Touch Pin Example - Print to the serial console when a pin is touched.
5+
"""
6+
import time
7+
import board
8+
import touchio
9+
10+
touch_one = touchio.TouchIn(board.A5)
11+
touch_two = touchio.TouchIn(board.D5)
12+
13+
while True:
14+
if touch_one.value:
15+
print("Pin one touched!")
16+
if touch_two.value:
17+
print("Pin two touched!")
18+
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 an LED using a button switch.
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
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
3+
# SPDX-License-Identifier: MIT
4+
"""
5+
CircuitPython Essentials Storage CP Filesystem boot.py file
6+
"""
7+
import time
8+
import board
9+
import digitalio
10+
import storage
11+
import neopixel
12+
13+
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)
14+
15+
button = digitalio.DigitalInOut(board.BUTTON)
16+
button.switch_to_input(pull=digitalio.Pull.UP)
17+
18+
# Turn the NeoPixel white for one second to indicate when to press the boot button.
19+
pixel.fill((255, 255, 255))
20+
time.sleep(1)
21+
22+
# If the button is connected to ground, the filesystem is writable by CircuitPython
23+
storage.remount("/", readonly=button.value)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
"""
4+
CircuitPython Essentials Storage CP Filesystem code.py file
5+
For use with boards with a built-in red LED.
6+
"""
7+
import time
8+
import board
9+
import digitalio
10+
import microcontroller
11+
12+
led = digitalio.DigitalInOut(board.LED)
13+
led.switch_to_output()
14+
15+
try:
16+
with open("/temperature.txt", "a") as temp_log:
17+
while True:
18+
# The microcontroller temperature in Celsius. Include the
19+
# math to do the C to F conversion here, if desired.
20+
temperature = microcontroller.cpu.temperature
21+
22+
# Write the temperature to the temperature.txt file every 10 seconds.
23+
temp_log.write('{0:.2f}\n'.format(temperature))
24+
temp_log.flush()
25+
26+
# Blink the LED on every write...
27+
led.value = True
28+
time.sleep(1) # ...for one second.
29+
led.value = False # Then turn it off...
30+
time.sleep(9) # ...for the other 9 seconds.
31+
32+
except OSError as e: # When the filesystem is NOT writable by CircuitPython...
33+
delay = 0.5 # ...blink the LED every half second.
34+
if e.args[0] == 28: # If the file system is full...
35+
delay = 0.15 # ...blink the LED every 0.15 seconds!
36+
while True:
37+
led.value = not led.value
38+
time.sleep(delay)

CircuitPython_Templates/Analog_Pin_Values_Nonstandard_AREF/code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
2-
# SPDX-License-Identifier: Unlicense
2+
# SPDX-License-Identifier: MIT
33
"""
44
CircuitPython analog voltage value example
55

CircuitPython_Templates/analog_pin_values/code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
2-
# SPDX-License-Identifier: Unlicense
2+
# SPDX-License-Identifier: MIT
33
"""CircuitPython analog pin value example"""
44
import time
55
import board

CircuitPython_Templates/analog_voltage_values/code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
2-
# SPDX-License-Identifier: Unlicense
2+
# SPDX-License-Identifier: MIT
33
"""CircuitPython analog voltage value example"""
44
import time
55
import board

CircuitPython_Templates/audio_find_pins/code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
2-
# SPDX-License-Identifier: Unlicense
2+
# SPDX-License-Identifier: MIT
33
"""
44
CircuitPython Audio-capable pin identifying script
55
"""

0 commit comments

Comments
 (0)