M5Dial - Button not working?



  • Hey guys,

    New here and new to UIFlow2. Got a M5Dial that I am playing with. I got the encoder working etc. But I can't get the inbuilt button press in it working.

    I have the "Button" added to my hardware list (it was included automatically based on my M5Dial hardware profile). Under it I can find the event "When button BtnA was X" which I have added. I have put a simple "set label0 to Hello". But it never triggers. I've tried pressed, clicked, held etc.

    I tried in my loop as well to do a "if pressed" but that doesnt work either.

    What am I missing? Do I need to initialise or configure the button somehow?

    Here is the code generated for it,

    def btnA_wasClicked_event(state):
    global Background, image1, image2, image3, image4, label0, rgb, rotary, http_req
    label0.setText(str('Clicked!'))

    def setup():
    BtnA.setCallback(type=BtnA.CB_TYPE.WAS_CLICKED, cb=btnA_wasClicked_event)



  • Hello @Fredde

    make sure you have the Update button, touch, etc. in loop block activated in loop. E.g.

    def loop():
      global label0
      M5.update()
    

    Thanks
    Felix



  • @felmue Amazing felmue! Thanks that was it!