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

    Stopwatch - Core2- Need help

    Scheduled Pinned Locked Moved Core 2
    4 Posts 3 Posters 7.2k Views 1 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.
    • M Offline
      morrischen
      last edited by

      Hello, I am trying to create a stopwatch but cannot figure out why it doesn't work. Here are some pictures: 0_1610730824290_Skärmavbild 2021-01-15 kl. 18.12.05.png 0_1610730830305_Skärmavbild 2021-01-15 kl. 18.11.45.png

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

        Hello @morrischen

        you are very close. Right now your code only executes once after loading and running it onto your M5Core2. Try putting all your existing code into a loop statement. (You'll find the loop statement in the Event section.)

        Cheers
        Felix

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

        M 1 Reply Last reply Reply Quote 1
        • R Offline
          robalstona
          last edited by robalstona

          Hi. I wrote something like this. I set the timer to increment the counter variable every 0.1s. Button A pauses / resumes timer operation. Button B resets the counter (the counter variable). The current counter value is displayed in the main loop of the program, scaled to seconds and hundredths of a second. One value of the counter variable in my case corresponds to 0.1s. You may need to modify the display_time function, because in my case (firmware 1.4.5) the lcd print function displays the result in the previous place overwriting the previous result. In later firmware the displayed result may overlap the previous one.

          This is also an incomplete example, so the displayed time may overwrite hundredths of a second after exceeding 99 seconds

          0_1611061798586_Screenshot_20210119-134354-01.jpeg

          1 Reply Last reply Reply Quote 1
          • M Offline
            morrischen @felmue
            last edited by

            @felmue Thanks, that fixed 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