how create stop button timer/stopwatch android control ?

hi now I’m making a project stopwatch or timer is in control of the android app start, stop and reset the timer in arduino in the show in lcd 16 x 2 but I was wondering how the programming for the method “TIMER STOP” button when finished logic stop on tap then the timer stops and the time is not reset to
00: 00: 00: 00 but stops displaying the time when the accounts at the stop. I really appreciate your help. thanks :slight_smile: :slight_smile:

#include <LiquidCrystal_I2C.h>
#include <SoftwareSerial.h>

int h,m,s,ms;
//byte tombol,kode;
LiquidCrystal_I2C lcd(0x3F ,2,1,0,4,5,6,7,3, POSITIVE);

int bluetoothTx = 0;
int bluetoothRx = 1;
char val;

void setup() {
Serial.begin(9600);
  
lcd.begin(16, 2);
lcd.clear();
lcd.print("JT 777");
lcd.setCursor(0,1);
lcd.print("00:00:00:00");
pinMode(8,INPUT);
pinMode(9,INPUT);
}


void loop() {
if( Serial.available() >0 ) {
    val = Serial.read();
    Serial.println(val);
}
if(val=='0'){
  ms=0;
  s=0;
  m=0;
  h=0;
  lcd.setCursor(0,1);
  lcd.print(h);
  lcd.print(':');
  lcd.print(m);
  lcd.print(':');
  lcd.print(s);
  lcd.print(':');
  lcd.print(ms);
  lcd.print(" ");
  delay(250);
}
if(val=='1'){
  ms++;
  delay(100);
  if(ms==10){
    ms=0;
    s++;
  delay(100);
 if(s==59){
    s=0;
    m++;
    delay(100);
    }
  if(m==59){
      m=0;
      h++;
   delay(100);
    }
  if(h==24){
      h=0;
      m=0;
      s=0;
      ms=0;
      ms++;
    }
  }
  Serial.println();
  lcd.setCursor(0,1);
  lcd.print(h);
  lcd.print(':');
  lcd.print(m);
  lcd.print(':');
  lcd.print(s);
  lcd.print(':');
  lcd.print(ms);
  lcd.print(" ");
}
}

diotoar:
hi now I'm making a project stopwatch or timer is in control of the android app start, stop and reset the timer in arduino in the show in lcd 16 x 2 but I was wondering how the programming for the method "TIMER STOP" button when finished logic stop on tap then the timer stops and the time is not reset to
00: 00: 00: 00 but stops displaying the time when the accounts at the stop. I really appreciate your help. thanks :slight_smile: :slight_smile:

Please re-read that carefully and see if it makes any sense to you because I can make no sense of it. I suspect there are several separate sentences in it but I can't figure where they begin and end. And if it was broken out into sentences I suspect it would be obvious that there is a lot of extra stuff needed.

If you wrote a program with as little thought as that the compiler would reject it. People should be treated with even more consideration than an inanimate compiler.

...R