Template cleanup.

This commit is contained in:
Kattni Rembor 2021-07-30 12:27:30 -04:00
parent ac7bd89118
commit fda69dc4b3
25 changed files with 67 additions and 109 deletions

View file

@ -1,22 +0,0 @@
"""CircuitPython NeoPixel Rainbow example for ItsyBitsy RP2040"""
import time
import board
import neopixel
from _pixelbuf import colorwheel
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, auto_write=False)
pixel.brightness = 0.3
def rainbow(delay):
for color_value in range(255):
for led in range(1):
pixel_index = (led * 256 // 1) + color_value
pixel[led] = colorwheel(pixel_index & 255)
pixel.show()
time.sleep(delay)
while True:
rainbow(0.02)

View file

@ -1,4 +1,4 @@
"""CircuitPython Capacitive Touch NeoPixel Brightness Control Exmaple"""
"""CircuitPython Capacitive Touch NeoPixel Brightness Control Example"""
import time
import board
import touchio

View file

@ -0,0 +1,10 @@
"""CircuitPython analog pin value example"""
import time
import board
import analogio
analog_pin = analogio.AnalogIn(board.A0)
while True:
print(analog_pin.value)
time.sleep(0.1)

View file

@ -0,0 +1,15 @@
"""CircuitPython analog voltage value example"""
import time
import board
import analogio
analog_pin = analogio.AnalogIn(board.A0)
def get_voltage(pin):
return (pin.value * 3.3) / 65535
while True:
print(get_voltage(analog_pin))
time.sleep(0.1)

View file

@ -1,31 +0,0 @@
"""
CircuitPython status NeoPixel rainbow example.
Update PIXELBUF_VERSION to _pixelbuf if available for the board (this is the most common case!)
or to adafruit_pypixelbuf where necessary (typically non-Express SAMD21 M0 boards).
For example:
If you are using a QT Py RP2040, change PIXELBUF_VERSION to _pixelbuf.
If you are using a QT Py M0, change PIXELBUF_VERSION to adafruit_pypixelbuf.
"""
import time
import board
import neopixel
from PIXELBUF_VERSION import colorwheel
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, auto_write=False)
pixel.brightness = 0.3
def rainbow(delay):
for color_value in range(255):
for led in range(1):
pixel_index = (led * 256 // 1) + color_value
pixel[led] = colorwheel(pixel_index & 255)
pixel.show()
time.sleep(delay)
while True:
rainbow(0.02)

View file

@ -1,8 +1,14 @@
"""CircuitPython NeoPixel Rainbow example for Feather RP2040"""
"""CircuitPython status NeoPixel rainbow example."""
import time
import board
import neopixel
try:
from rainbowio import colorwheel
except ImportError:
try:
from _pixelbuf import colorwheel
except ImportError:
from adafruit_pypixelbuf import colorwheel
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, auto_write=False)

View file

@ -9,13 +9,6 @@ in THREE places in the code.
For example:
If you are using a FunHouse, change NUMBER_OF_PIXELS to 5.
** Update PIXELBUF_VERSION to _pixelbuf if available for the board (this is the most common case!)
or to adafruit_pypixelbuf where necessary (typically non-Express SAMD21 M0 boards).
For example:
If you are using a FunHouse, change PIXELBUF_VERSION to _pixelbuf.
If you are using a Trinket M0, change PIXELBUF_VERSION to adafruit_pypixelbuf.
** DO NOT INCLUDE THE pylint: disable LINE IN THE GUIDE CODE. It is present only to deal with the
NUMBER_OF_PIXELS variable being undefined, and the dots setup line being too long with the variable
in it in this pseudo-code. As you will be updating the variable in the guide, you will not need
@ -26,7 +19,13 @@ the pylint: disable.
import time
import board
import adafruit_dotstar
from PIXELBUF_VERSION import colorwheel
try:
from rainbowio import colorwheel
except ImportError:
try:
from _pixelbuf import colorwheel
except ImportError:
from adafruit_pypixelbuf import colorwheel
dots = adafruit_dotstar.DotStar(board.DOTSTAR_CLOCK, board.DOTSTAR_DATA, NUMBER_OF_PIXELS, auto_write=False)
dots.brightness = 0.3

View file

@ -0,0 +1,25 @@
"""
CircuitPython Essentials Storage CP Filesystem boot.py file
There are three things to be updated in this file to match your board:
* Update OBJECT_NAME to match the physical thing you are using, e.g. button or pin.
* Update OBJECT_PIN to match the pin name to which the button or pin is attached.
* Update UP_OR_DOWN to match the Pull necessary for the chosen pin.
For example:
If using the up button on a FunHouse, update OBJECT_NAME to button, and OBJECT_PIN to BUTTON_UP.
If using pin A0 on a Feather RP2040, update OBJECT_NAME to pin, and OBJECT_PIN to A0.
For example:
If using the up button on a FunHouse, update UP_OR_DOWN to DOWN.
IF using pin A0 on a Feather RP2040, update UP_OR_DOWN to UP.
"""
import board
import digitalio
import storage
OBJECT_NAME = digitalio.DigitalInOut(board.OBJECT_PIN)
OBJECT_NAME.switch_to_input(pull=digitalio.Pull.UP_OR_DOWN)
# If the OBJECT_NAME is connected to ground, the filesystem is writable by CircuitPython
storage.remount("/", readonly=OBJECT_NAME.value)

View file

@ -40,7 +40,7 @@ labels = []
for index in range(12):
x = index % 3
y = index // 3
labels.append(label.Label(terminalio.FONT, text=label_names[index], max_glyphs=10))
labels.append(label.Label(terminalio.FONT, text=label_names[index]))
layout.add_content(labels[index], grid_position=(x, y), cell_size=(1, 1))
# Display the text

View file

@ -1,22 +0,0 @@
"""NeoKey Trinkey NeoPixel Rainbow Example"""
import time
import board
import neopixel
from _pixelbuf import colorwheel
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, auto_write=False)
pixel.brightness = 0.3
def rainbow(delay):
for color_value in range(255):
for led in range(1):
pixel_index = (led * 256 // 1) + color_value
pixel[led] = colorwheel(pixel_index & 255)
pixel.show()
time.sleep(delay)
while True:
rainbow(0.02)

View file

@ -1,22 +0,0 @@
"""CircuitPython NeoPixel rainbow example for QT Py RP2040"""
import time
import board
import neopixel
from _pixelbuf import colorwheel
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, auto_write=False)
pixel.brightness = 0.3
def rainbow(delay):
for color_value in range(255):
for led in range(1):
pixel_index = (led * 256 // 1) + color_value
pixel[led] = colorwheel(pixel_index & 255)
pixel.show()
time.sleep(delay)
while True:
rainbow(0.02)