Created
October 25, 2022 04:16
-
-
Save neosarchizo/a6c9f81151dbded8580d1ad19e423e95 to your computer and use it in GitHub Desktop.
MicroPython - ESP32 네오픽셀 제어
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from machine import Pin | |
from neopixel import NeoPixel | |
from time import sleep | |
RED =(255, 0, 0) | |
GREEN =(0, 255, 0) | |
BLUE =(0, 0, 255) | |
WHITE =(255, 255, 255) | |
pixels = NeoPixel(Pin(22, Pin.OUT), 30) | |
def fill_color(color): | |
for i in range(30): | |
pixels[i] = color | |
while True: | |
fill_color(RED) | |
pixels.write() | |
sleep(1) | |
fill_color(GREEN) | |
pixels.write() | |
sleep(1) | |
fill_color(BLUE) | |
pixels.write() | |
sleep(1) | |
fill_color(WHITE) | |
pixels.write() | |
sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment