Adding MicroPython NeoPixel Blink

This commit is contained in:
Kattni Rembor 2022-06-07 13:19:20 -04:00
parent 968bd46a2c
commit b4b80a89cf

View file

@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: 2022 Kattni Rembor for Adafruit Industries
# SPDX-License-Identifier: MIT
import time
from machine import Pin
from neopixel import NeoPixel
power_pin = Pin(8, Pin.OUT) # NeoPixel power is on pin 8
power_pin.on() # Enable the NeoPixel Power
pin = Pin(5, Pin.OUT) # Onboard NeoPixel is on pin 5
np = NeoPixel(pin, 1) # create NeoPixel driver on pin 5 for 1 pixel
while True:
np.fill((0, 0, 150)) # Set the NeoPixel blue
np.write() # Write data to the NeoPixel
time.sleep(0.5) # Pause for 0.5 seconds
np.fill((0, 0, 0)) # Turn the NeoPixel off
np.write() # Write data to the NeoPixel
time.sleep(0.5) # Pause for 0.5 seconds