Adding MicroPython NeoPixel Blink
This commit is contained in:
parent
968bd46a2c
commit
b4b80a89cf
1 changed files with 19 additions and 0 deletions
19
MicroPython_NeoPixel_Blink/main.py
Normal file
19
MicroPython_NeoPixel_Blink/main.py
Normal 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
|
||||||
Loading…
Reference in a new issue