Fix digital input example to use NeoPixel.

This commit is contained in:
Kattni Rembor 2022-03-04 16:21:29 -05:00
parent 2c05295a78
commit 702743a9f5

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))