Skip to content

Commit a02bb6e

Browse files
committed
Adding QT Py RP2040 digital input example.
1 parent bcbe569 commit a02bb6e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
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 commit comments

Comments
 (0)