UIFlow digital input interrupt



  • In UIFlow is it possible to use an interrupt on an input? when I get a sub millisecond low signal on an input I would like to run some code.


  • M5Stack

    When you say sub millisecond I guess you are not going to use a button to interrupt, if so then how do you intend to interrupt from an input



  • 50hz triac phase control with zero crossing timing synchronization. 100micro second timing tolerance or better. I ended up porting to Arduino/C++, too many limitations with UIFlow for now, python maybe to slow anyway. UIFlow is a good tool for higher level/basic control.



  • Hello,
    try an execute block, look at my code below.

    First i defined the two variables "is_running" and "counter".
    In UIFlow i defined pin0 with GPIO26 as input with pull down resistor.!
    Then i defined the event_interrupt(pin) - procedure. I use it for counting impulses at the GPIO26, therefore it is necessary to declare the variables as globals.

    Every second i read in the main loop the value of the counter variable and reset the is_running variable.

    def event_interrupt(pin):
    global is_running, counter
    is_running = True
    counter += 1

    pin0.irq(trigger=machine.Pin.IRQ_RISING, handler=event_interrupt)

    0_1595778123207_interrupt.jpg