Add initial project files including configuration and LED control scripts
- Create .gitignore to exclude unnecessary files - Add .micropico for project identification - Implement config.json for switch configurations - Develop led_panel_blink.py for LED control with color cycling - Create main.py to manage switch commands and interactions - Introduce servo.py for servo control functionality - Define switch.py to handle switch operations with servo integration
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
from machine import Pin
|
||||
import neopixel
|
||||
import time
|
||||
import random
|
||||
|
||||
# Настройки: 8 LED, подключено к GP6
|
||||
num_leds = 8
|
||||
pin = 6 # GP6
|
||||
|
||||
np = neopixel.NeoPixel(Pin(pin), num_leds)
|
||||
|
||||
red = (255, 0, 0) # Красный (R, G, B)
|
||||
green = (0, 255, 0) # Зеленый
|
||||
blue = (0, 0, 255) # Синий
|
||||
orange = (255, 165, 0) # Оранжевый
|
||||
moon_white = (224, 224, 192) # Лунный белый
|
||||
off = (0, 0, 0) # Выключено
|
||||
|
||||
while True:
|
||||
np.fill(red) # Все LED красные
|
||||
colors = [red, green, blue, orange, moon_white]
|
||||
for i in range(num_leds):
|
||||
np[i] = random.choice(colors)
|
||||
np.write() # Обновить
|
||||
time.sleep(0.5) # Пауза 0.5 сек
|
||||
|
||||
np.fill(off) # Все выключить
|
||||
np.write()
|
||||
time.sleep(0.5)
|
||||
Reference in New Issue
Block a user