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

    Stopwatch - Core2- Need help

    Core 2
    3
    4
    5.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.
    • M
      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
        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
          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
            morrischen @felmue
            last edited by

            @felmue Thanks, that fixed it

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