Format RGB LED Scripts
MODIFY
RGB_LED_Strips/main.py
RGB_LED_Strips/main.py
+import time
+
import board
import pulseio
-import time
RED_PIN = board.D5 # Red LED pin
GREEN_PIN = board.D6 # Green LED pin
@@ -14,10 +15,14 @@ red = pulseio.PWMOut(RED_PIN)
green = pulseio.PWMOut(GREEN_PIN)
blue = pulseio.PWMOut(BLUE_PIN)
+
# Function to simplify setting duty cycle to percent value.
+
+
def duty_cycle(percent):
return int(percent / 100.0 * 65535.0)
+
# Fade from nothing up to full red.
for i in range(100):
red.duty_cycle = duty_cycle(i)

Format RGB LED Scripts