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

# GPIO 34 & 35 input only

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(i*50)
            time.sleep_ms(50)
        for i in range(20, 0, -1):
            led.duty(i*50)
            time.sleep_ms(50)
    led.deinit()


main()

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