# mPy - Toggle Leds on button press on FSK0001
# Copyright by Anthony Vogelaar, Perth Scotland
# revision 0.10  2025-11-26  initial release

from	machine	import	Pin
import	time

# ====================== hardware =======================

pins_led = (25, 26, 27, 14)
pins_btn = (33, 32, 35, 34)

leds = [Pin(pin, Pin.OUT, value=0)    for pin in pins_led]
btns = [Pin(pin, Pin.IN, Pin.PULL_UP) for pin in pins_btn]

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

    
def main():

    # warning: spurious IRQ's are also received
    def onBtn(sender):
        idx = btns.index(sender)
        leds[idx].toggle()
    
    
    for btn in btns:
        btn.irq(onBtn, Pin.IRQ_FALLING)
    while True:
        print('*', end='')
        time.sleep(1)
        
        
main()

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