Hello,
thank you very much. Unfortunately I get now the following error:
Code: Select all
TypeError: function takes 0 positional arguments but 1 were given
.. I I still don't know how to do it. I think I miss something... and I don't find any proper tutorial/example to figure it out by myself. Could you give me a hand on this? Here is my complete code.
Code: Select all
i = 1
def switchup():
global i
# raise or reset i
if i < 9:
i = i+1
else:
i = 1
# trigger function with USR switch
sw = pyb.Switch()
sw.callback(switchup)
# IN Pins -> This should replace USR switch
sw_up = Pin('Y12', Pin.IN, Pin.PULL_UP)
sw_up.irq(handler=switchup, trigger=Pin.IRQ_RISING)
I want to replace "sw" (USR button) by "sw_up" (external Button attached between Y12 and GND).
On each button press, "i" should increase (or be reset). This works fine with "sw", but not with "sw_up" because of this IRQ thing.
Thank you so much for the support!
All the best
Vince