Skip to content

Commit 702743a

Browse files
committed
Fix digital input example to use NeoPixel.
1 parent 2c05295 commit 702743a

File tree

1 file changed

+19
-0
lines changed
  • Adafruit_QT_Py_ESP32-S2/digital_input

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
"""
4+
CircuitPython Digital Input example - Blinking a built-in NeoPixel LED using a button switch.
5+
"""
6+
import board
7+
import digitalio
8+
import neopixel
9+
10+
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)
11+
12+
button = digitalio.DigitalInOut(board.BUTTON)
13+
button.switch_to_input(pull=digitalio.Pull.UP)
14+
15+
while True:
16+
if not button.value:
17+
pixel.fill((255, 0, 0))
18+
else:
19+
pixel.fill((0, 0, 0))

0 commit comments

Comments
 (0)