Skip to content

Commit a0bffd6

Browse files
authored
Merge pull request #1518 from kattni/qt-py-rp-digital-input
Adding QT Py RP2040 digital input example.
2 parents bcbe569 + 9e1e19e commit a0bffd6

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

CircuitPython_Templates/digital_input_one_neopixel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
if not button.value:
2222
pixel.fill((255, 0, 0))
2323
else:
24-
pixel.fill(0)
24+
pixel.fill((0, 0, 0))
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""CircuitPython Digital Input example - Blinking a built-in NeoPixel LED using a button switch."""
2+
import board
3+
import digitalio
4+
import neopixel
5+
6+
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)
7+
8+
button = digitalio.DigitalInOut(board.BUTTON)
9+
button.switch_to_input(pull=digitalio.Pull.UP)
10+
11+
while True:
12+
if not button.value:
13+
pixel.fill((255, 0, 0))
14+
else:
15+
pixel.fill((0, 0, 0))

0 commit comments

Comments
 (0)