🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5Dial - Button not working?

    UiFlow 2.0
    2
    3
    1.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      Fredde
      last edited by Fredde

      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)

      1 Reply Last reply Reply Quote 0
      • felmueF
        felmue
        last edited by felmue

        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

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        F 1 Reply Last reply Reply Quote 0
        • F
          Fredde @felmue
          last edited by

          @felmue Amazing felmue! Thanks that was it!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post