int Sec = 0; //Change the numbers from zero to set current time int Min = 0; int Hrs = 0; bool PM = 0; void setup() { Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: delay (1000); //Runs the loop every 1 second Sec ++; if (Sec==59) //On the 59th loop/sec increment minute and reset seconds { Min ++; Sec==0; } if (Min==59) //On the 59th minute increment Hour and reset minutes { Hrs ++; Min==0; } if (Hrs==12) //On the 12 Hour we set PM true and reset hour { PM=true; Hrs==0; } if (Hrs==12 && PM==1) //On the 2nd 12 Hour we set PM false and reset hour { PM=false; Hrs==0; } Serial.print(Hrs); Serial.print(":"); Serial.print(Min); Serial.print(":"); Serial.print(Sec); Serial.println(PM); }