# mPy - FKS0001 PWM excercises, glowing led, parabolic interpolation
# Copyright by Athony Vogelaar, Perth Scotland
# rev 0.10  2025-12-21  initial release

from 	machine	import	Pin, PWM, freq;		freq(240_000_000)
import	time

# ======================== main =============================

# Frequency range PWM: 1Hz .. 40 MHz 
def main():
    led = PWM(Pin(26), freq=200, duty=0)
    while True:
        for i in range(20):
            led.duty(int(i*i*2.5))
            time.sleep_ms(50)
        for i in range(20, 0, -1):
            led.duty(int(i*i*2.5))
            time.sleep_ms(50)
    led.deinit()


main()

# ======================== end =============================
