SH1106 OLED Stopwatch with Arduino and 2 buttons

Hello, can anyone write me down a code for stopwatch with SH1106 OLED and arduino with 2 buttons to control.
I want to be used StopWatch, U8glib libraries. The two buttons: the first one to start and pause the stopwatch and the second to reset it. I want to count: millis, seconds and minutes.

Thank you !

You'll be lucky if you can update the display in 1ms.
I'd aim for tenths to start with, maybe going down to hundredths later.

PowerBot:
Hello, can anyone write me down a code for stopwatch with SH1106 OLED and arduino with 2 buttons to control.
I want to be used StopWatch, U8glib libraries. The two buttons: the first one to start and pause the stopwatch and the second to reset it. I want to count: millis, seconds and minutes.

Thank you !

Like AWOL said, OLEDs do not update fast enough to display milliseconds. In the case of my device (Adafruit 0.96" 128x64 OLED, with SSD1306Ascii Library by William Greiman) it can only keep up with tenths. But the processor (12MHz 328 @ 3.3v) can handle milliseconds. So I display tenths (which is probably the fastest that humans can follow anyway) but report hundredths (or milliseconds) when the interval has completed, ie the stop button is pushed.
I’ve also tried this with Adafruit’s library, as it’s supposedly faster, but it works the same.

Actually I made one testing sketch and the display handled with the millis without a problem.

So what's the problem?

PowerBot:
Actually I made one testing sketch and the display handled with the millis without a problem.

How can you possibly see it? I find that anything quicker than 1/30-1/60 sec. is too fast for my retina.

AWOL:
So what's the problem?

Well I can't make it to separate the seconds and the minutes minutes also the buttons, I can make it start with the one button and stop with the other using If and Else. I know that its possible to start, pause and reset the stopwatch by using only one button but I don't know how to do it.

Well I can't make it to separate the seconds

What is "it" ?

AWOL:
What is "it" ?

The stopwatch.

Perhaps if we could see the "stopwatch", we might be able to help.

#include <StopWatch.h>
#include <U8glib.h>
 int buttonA = 5;
 int buttonB = 6;
 int buttonC = 7;
U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9, 8);

StopWatch sw_millis;    // MILLIS (default)

StopWatch sw_secs(StopWatch::SECONDS);


void draw(void){
    u8g.setFont(u8g_font_profont17r);
    u8g.setPrintPos(0, 30);
    u8g.print("m");
    u8g.println(sw_millis.elapsed());

}

void setup() {

pinMode(buttonA, INPUT_PULLUP);
pinMode(buttonB, INPUT_PULLUP);
pinMode(buttonC, INPUT_PULLUP);

}


void loop() {

if (digitalRead(buttonA) == LOW){
    sw_millis.start();
}
 else if (digitalRead(buttonB) == LOW){ 
sw_millis.stop();
}
else if (digitalRead(buttonC) == LOW)
{
sw_millis.reset()
}

  
    u8g.firstPage();  // Put information on OLED
      do {
        draw();
      } while( u8g.nextPage() );

    delay(1);
}

Here it is .

PowerBot:
The stopwatch.

AWOL:
Perhaps if we could see the "stopwatch", we might be able to help.

I putted the code !