# mPy - demo timer generated impulse on esp32s2
# Provided by Anthony Vogelaar, Perth Scotland
# rev 0.10  2024-07-04  initial release

from	machine import Pin, Timer, freq; 		freq(240000000)
import	time

# =========================== Test ================================
class Test:
    
    def __init__(self):
        self.pin = Pin(16, Pin.OUT)
        tmr      = Timer(3)
        tmr.init(period=1, mode=Timer.PERIODIC, callback=self.onTimer)
        while True:
            print('*', end='')
            time.sleep(1)
    
    
    # 15 uSec jitter observed
    def onTimer(self, sender):
        self.pin(1)
        self.pin(0)
        
# =========================== Main ==============================

Test()

# ============================ End ==============================
