Skip to content

Instantly share code, notes, and snippets.

@neosarchizo
Created October 25, 2022 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neosarchizo/a6c9f81151dbded8580d1ad19e423e95 to your computer and use it in GitHub Desktop.
Save neosarchizo/a6c9f81151dbded8580d1ad19e423e95 to your computer and use it in GitHub Desktop.
MicroPython - ESP32 네오픽셀 제어
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