from machine import Pin
from neopixel import NeoPixel
import time
# --- SETUP ---
# LED Strip configuratie
LED_PIN = 32 # De pin waar de Data-in van de strip aan hangt
NUM_LEDS = 8 # Aantal LEDs op de strip
np = NeoPixel(Pin(LED_PIN, Pin.OUT), NUM_LEDS)
# Knop configuratie (voor Oefening 8)
# We gebruiken hier Pin 25 als voorbeeld voor de schakelaar
# We gebruiken PULL_UP: knop niet ingedrukt = 1 (High), ingedrukt = 0 (Low)
button = Pin(25, Pin.IN, Pin.PULL_UP)
# --- HULPFUNCTIES ---
def clear_leds():
"""Zet alle LEDs uit"""
for i in range(NUM_LEDS):
np[i] = (0, 0, 0)
np.write()
# --- OEFENINGEN ---
clear_leds()
print("Oefening 2: Rood -> Groen -> Blauw (Min Intensiteit)")
# Intensiteit min = 1 (0 is uit, 1 is het zachtste licht)
# Rood
np[0] = (1, 0, 0)
np.write()
time.sleep(1)
# Groen
np[0] = (0, 1, 0)
np.write()
time.sleep(1)
# Blauw
np[0] = (0, 0, 1)
np.write()
time.sleep(1)