Merge pull request #2094 from kattni/qtpy-esp32s2-readd-file

Fix digital input example to use NeoPixel.
This commit is contained in:
Kattni 2022-03-04 17:05:04 -05:00 committed by GitHub
commit acefa00561
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
# SPDX-License-Identifier: MIT
"""
CircuitPython Digital Input example - Blinking a built-in NeoPixel LED using a button switch.
"""
import board
import digitalio
import neopixel
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)
button = digitalio.DigitalInOut(board.BUTTON)
button.switch_to_input(pull=digitalio.Pull.UP)
while True:
if not button.value:
pixel.fill((255, 0, 0))
else:
pixel.fill((0, 0, 0))