Adding template examples.
This commit is contained in:
parent
eb6403abe4
commit
b9058d8fb9
2 changed files with 33 additions and 0 deletions
22
NeoKey_Trinkey/CircuitPython_NeoPixel_Example/code.py
Normal file
22
NeoKey_Trinkey/CircuitPython_NeoPixel_Example/code.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"""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)
|
||||
11
NeoKey_Trinkey/CircuitPython_Touch_Example/code.py
Normal file
11
NeoKey_Trinkey/CircuitPython_Touch_Example/code.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
"""NeoKey Trinkey Capacitive Touch Example"""
|
||||
import time
|
||||
import board
|
||||
import touchio
|
||||
|
||||
touch = touchio.TouchIn(board.TOUCH)
|
||||
|
||||
while True:
|
||||
if touch.value:
|
||||
print("Pad touched!")
|
||||
time.sleep(0.1)
|
||||
Loading…
Reference in a new issue