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

    M5Dial - Button not working?

    Scheduled Pinned Locked Moved UiFlow 2.0
    3 Posts 2 Posters 2.8k Views
    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 Offline
      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 Offline
        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 Offline
          Fredde @felmue
          last edited by

          @felmue Amazing felmue! Thanks that was it!

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post