def pulse(led, delay): for i in range(200): led.duty(int(math.sin(i/10*math.pi)*500 + 500)) time.sleep_ms(delay)