SerialCode

int timer;
int stp = 0;
String data;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
if( stp == 0)
{
timer = timer + 1;
Serial.println(timer);
}
if(Serial.available())
{
data = Serial.readString();
if(data == “reset”)
{
timer = 0;
}
if(data == “stop”)
{
stp = 1;
}
if(data == “start”)
{
stp = 0;
}
}
delay(1000);
}