Skip to content

Commit f8409ef

Browse files
authored
Merge pull request #2183 from kattni/qt-py-pico-micropython-blink
Adding MicroPython NeoPixel Blink
2 parents 968bd46 + b4b80a8 commit f8409ef

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

MicroPython_NeoPixel_Blink/main.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-FileCopyrightText: 2022 Kattni Rembor for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
import time
4+
from machine import Pin
5+
from neopixel import NeoPixel
6+
7+
power_pin = Pin(8, Pin.OUT) # NeoPixel power is on pin 8
8+
power_pin.on() # Enable the NeoPixel Power
9+
10+
pin = Pin(5, Pin.OUT) # Onboard NeoPixel is on pin 5
11+
np = NeoPixel(pin, 1) # create NeoPixel driver on pin 5 for 1 pixel
12+
13+
while True:
14+
np.fill((0, 0, 150)) # Set the NeoPixel blue
15+
np.write() # Write data to the NeoPixel
16+
time.sleep(0.5) # Pause for 0.5 seconds
17+
np.fill((0, 0, 0)) # Turn the NeoPixel off
18+
np.write() # Write data to the NeoPixel
19+
time.sleep(0.5) # Pause for 0.5 seconds

0 commit comments

Comments
 (0)