from machine import Pin, PWM import time import math _init() LedPinB = 15 LedPinG = 14 LedPinR = 13 ledB = Pin(LedPinB, Pin.OUT) ledG = Pin(LedPinG, Pin.OUT) ledR = Pin(LedPinR, Pin.OUT) pwmB = PWM(ledB) pwmG = PWM(ledG) pwmR = PWM(ledR) pwmB.freq(500) pwmG.freq(500) pwmR.freq(500) while True: for i in range(100): pwmB.duty(int(math.sin(i / 50 * math.pi) * 500 + 500)) pwmG.duty(int(math.sin(i / 75 * math.pi) * 500 + 500)) pwmR.duty(int(math.sin(i / 25 * math.pi) * 500 + 500)) time.sleep_ms(30)