Stopwatch - Core2- Need help



  • 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



  • 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



  • 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



  • @felmue Thanks, that fixed it