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

    Newbie question - cycle functions via one button

    Scheduled Pinned Locked Moved SOFTWARE
    4 Posts 2 Posters 7.6k Views 2 Watching
    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.
    • L Offline
      Lukash616
      last edited by

      Hi, I'm making a very simple D&D dice program for the M5stick C via UI Flow blockly.

      I want to be able to use button A to cycle through different dice, as it stands I can only figure out how to do it using wasPressed, DoublePress and longPress.

      What would be the best way to just use single press to cycle functions?

      Here is the beginning of my code, i'm sure it's probably not the most efficient way:
      0_1597834410475_Capture.JPG

      A 1 Reply Last reply Reply Quote 0
      • A Offline
        ardo @Lukash616
        last edited by

        @lukash616

        This maybe could point you in the right direction (subject to improvement ofc.):
        0_1597837649209_Somedice.png

        1 Reply Last reply Reply Quote 0
        • L Offline
          Lukash616
          last edited by

          Right done some more fiddling and it's almost how i want it. The below works but instead of using wasPressed, longPress and wasDoublePress - i want all states to be selectable by wasPressed.

          Is there a way to do wasPressed Xtimes?

          0_1597840936064_Capture.JPG

          1 Reply Last reply Reply Quote 0
          • L Offline
            Lukash616
            last edited by

            I've figured it out, needed to use lists - this solved it for me https://www.youtube.com/watch?v=4jDVYZSYTo4

            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