Skip to content

Commit 272ec17

Browse files
authored
Merge pull request #1558 from kattni/neokey-template-examples
Adding template examples.
2 parents a2b5d30 + b9058d8 commit 272ec17

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

  • NeoKey_Trinkey
    • CircuitPython_NeoPixel_Example
    • CircuitPython_Touch_Example
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""NeoKey Trinkey NeoPixel Rainbow Example"""
2+
import time
3+
import board
4+
import neopixel
5+
from _pixelbuf import colorwheel
6+
7+
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, auto_write=False)
8+
9+
pixel.brightness = 0.3
10+
11+
12+
def rainbow(delay):
13+
for color_value in range(255):
14+
for led in range(1):
15+
pixel_index = (led * 256 // 1) + color_value
16+
pixel[led] = colorwheel(pixel_index & 255)
17+
pixel.show()
18+
time.sleep(delay)
19+
20+
21+
while True:
22+
rainbow(0.02)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""NeoKey Trinkey Capacitive Touch Example"""
2+
import time
3+
import board
4+
import touchio
5+
6+
touch = touchio.TouchIn(board.TOUCH)
7+
8+
while True:
9+
if touch.value:
10+
print("Pad touched!")
11+
time.sleep(0.1)

0 commit comments

Comments
 (0)