{"id":3213,"date":"2022-10-15T06:02:54","date_gmt":"2022-10-15T13:02:54","guid":{"rendered":"https:\/\/www.donluc.com\/?p=3213"},"modified":"2022-10-15T06:02:54","modified_gmt":"2022-10-15T13:02:54","slug":"project-21-nixie-stopwatch-mk04","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=3213","title":{"rendered":"Project #21 &#8211; Nixie &#8211; Stopwatch &#8211; Mk04"},"content":{"rendered":"<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3213-1\" width=\"720\" height=\"480\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/10\/DL2209Mk04W.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/10\/DL2209Mk04W.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/10\/DL2209Mk04W.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p>#DonLucElectronics #DonLuc #NixieTube #Nixie #ArduiNIX #ArduinoMega2560 #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/10\/DL2209Mk04a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/10\/DL2209Mk04a.png\" alt=\"Stopwatch\" width=\"720\" height=\"639\" class=\"alignnone size-full wp-image-3215\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/10\/DL2209Mk04a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/10\/DL2209Mk04a-300x266.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/10\/DL2209Mk04b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/10\/DL2209Mk04b.png\" alt=\"Stopwatch\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3216\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/10\/DL2209Mk04b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/10\/DL2209Mk04b-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/10\/DL2209Mk04c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/10\/DL2209Mk04c.png\" alt=\"Stopwatch\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3217\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/10\/DL2209Mk04c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2022\/10\/DL2209Mk04c-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>Stopwatch<\/strong><\/p>\n<p>A stopwatch is a timepiece designed to measure the amount of time that elapses between its activation and deactivation. In manual timing, the clock is started and stopped by a person pressing a button. The timing functions are traditionally controlled by two buttons on the case. Pressing the top button starts the timer running, and pressing the button a second time stops it, leaving the elapsed time displayed. A press of the second button then resets the stopwatch to zero. The second button is also used to record split times or lap times. When the split time button is pressed while the watch is running it allows the elapsed time to that point to be read, but the watch mechanism continues running to record total elapsed time. Pressing the split button a second time allows the watch to resume display of total time.<\/p>\n<p><strong>DL2209Mk04<\/strong><\/p>\n<p>1 x Arduino Mega 2560 R2<br \/>\n1 x ArduiNIX V3 Tube Driver Shield Kit<br \/>\n1 x IN-17&#215;8 V1 Tube Board Kit<br \/>\n1 x Anode \/ Cathode Connector Cable Set<br \/>\n1 x DS3231 Precision RTC FeatherWing<br \/>\n1 x CR1220 12mm Coin Cell Battery<br \/>\n2 x Rocker Switch &#8211; SPST<br \/>\n5 x 10K Ohm<br \/>\n1 x Momentary Button &#8211; Panel Mount (Blue)<br \/>\n2 x Momentary Button &#8211; Panel Mount (Black)<br \/>\n1 x SparkFun ProtoShield<br \/>\n1 x 9V 1000mA Power Supply<br \/>\n1 x SparkFun Cerberus USB Cable<\/p>\n<p><strong>Arduino Mega 2560 R2<\/strong><\/p>\n<p>SN2 &#8211; 2<br \/>\nSN3 &#8211; 3<br \/>\nSN4 &#8211; 4<br \/>\nSN5 &#8211; 5<br \/>\nSN6 &#8211; 6<br \/>\nSN7 &#8211; 7<br \/>\nSN8 &#8211; 8<br \/>\nSN9 &#8211; 9<br \/>\nAN10 &#8211; 10<br \/>\nAN11 &#8211; 11<br \/>\nAN12 &#8211; 12<br \/>\nAN13 &#8211; 13<br \/>\nSDA &#8211; 20<br \/>\nSCL &#8211; 21<br \/>\nRO0 &#8211; 53<br \/>\nRO1 &#8211; 51<br \/>\nMB0 = 49<br \/>\nMB1 = 47<br \/>\nMB2 = 45<br \/>\nVIN &#8211; +3.3V<br \/>\nVIN &#8211; +5V<br \/>\nVIN &#8211; +9V<br \/>\nGND &#8211; GND<\/p>\n<p><strong>DL2209Mk04p.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/* ***** Don Luc Electronics \u00a9 *****\r\nSoftware Version Information\r\nProject #21 - Nixie - Stopwatch - Mk04\r\n21-04\r\nDL2209Mk04p.ino\r\n1 x Arduino Mega 2560 R2\r\n1 x ArduiNIX V3 Tube Driver Shield Kit\r\n1 x IN-17x8 V1 Tube Board Kit\r\n1 x Anode \/ Cathode Connector Cable Set\r\n1 x DS3231 Precision RTC FeatherWing\r\n1 x CR1220 12mm Coin Cell Battery\r\n2 x Rocker Switch - SPST\r\n5 x 10K Ohm\r\n1 x Momentary Button - Panel Mount (Blue)\r\n2 x Momentary Button - Panel Mount (Black)\r\n1 x 9V 1000mA Power Supply\r\n1 x SparkFun Cerberus USB Cable\r\n*\/\r\n\r\n\/\/ Include the Library Code\r\n\/\/ Wire you to communicate with I2C\/TWI devices\r\n\/\/ Date and Time DS3231 RTC\r\n#include &quot;RTClib.h&quot;\r\n\r\n\/\/ SN74141 (1)\r\nint ledPin_0_a = 2;                \r\nint ledPin_0_b = 3;\r\nint ledPin_0_c = 4;\r\nint ledPin_0_d = 5;\r\n\r\n\/\/ SN74141 (2)\r\nint ledPin_1_a = 6;                \r\nint ledPin_1_b = 7;\r\nint ledPin_1_c = 8;\r\nint ledPin_1_d = 9;\r\n\r\n\/\/ Anode pins\r\nint ledPin_a_1 = 10;\r\nint ledPin_a_2 = 11;\r\nint ledPin_a_3 = 12;\r\nint ledPin_a_4 = 13;\r\n\r\n\/\/ Fade\r\nfloat fadeMax = 0.1f;\r\nfloat fadeStep = 0.1f;\r\n\/\/ Number Array\r\nint NumberArray[8]={0,0,0,0,0,0,0,0};\r\nint currNumberArray[8]={0,0,0,0,0,0,0,0};\r\nfloat NumberArrayFadeInValue[8]={0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f};\r\nfloat NumberArrayFadeOutValue[8]={5.0f,5.0f,5.0f,5.0f,5.0f,5.0f,5.0f,5.0f};\r\n\r\n\/\/ Date and time functions using a DS3231 RTC\r\nRTC_DS3231 RTC;\r\n\r\n\/\/ Rocker Switch - SPST\r\n\/\/ Rocker Switch 0\r\nconst int iRO0 = 53;\r\n\/\/ State\r\nint iRO0State = 0;\r\n\/\/ Rocker Switch 1\r\nconst int iRO1 = 51;\r\n\/\/ State\r\nint iRO1State = 0;\r\n\r\n\/\/ Momentary Button\r\nconst int iStartP = 49;\r\nconst int iStopP = 47;\r\nconst int iResetP = 45;\r\n\r\n\/\/ Setting hours, minutes, secound and miliseconds to 0\r\nint iH = 0;\r\nint iM = 0;\r\nint iS = 0;\r\nint iMS = 0;\r\nint iMSS = 0;\r\n\r\n\/\/ Defines starting points\r\nint iStart = 0;\r\nint iStop1 = 0;\r\nint iReset = 0;\r\n\r\n\/\/ Get the high and low order values for hours,min,seconds. \r\nint lowerHours = 0;\r\nint upperHours = 0;\r\nint lowerMins = 0;\r\nint upperMins = 0;\r\nint lowerSeconds = 0;\r\nint upperSeconds = 0;\r\nint lowerMiliseconds = 0;\r\nint upperMiliseconds = 0;\r\n\r\n\/\/ Software Version Information\r\nString sver = &quot;21-04&quot;;\r\n\r\nvoid loop() {\r\n\r\n  \/\/ Read the state of the Switch value\r\n  iRO1State = digitalRead(iRO1);\r\n  \r\n  \/\/ If it is the Switch State is HIGH\r\n  if (iRO1State == HIGH) {\r\n  \r\n    \/\/ Stopwatch\r\n    isStart();\r\n\r\n  } else {\r\n\r\n    \/\/ Date ans Time\r\n    isTimeRTC();\r\n    \r\n  }\r\n\r\n}\r\n<\/pre>\n<p><strong>getDisplayFadeNumber.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Display Fade Number\r\nvoid DisplayFadeNumberString()\r\n{\r\n \r\n  \/\/ Anode channel 1 - numerals 0,4\r\n  SetSN74141Chips(currNumberArray[0],currNumberArray[4]);   \r\n  digitalWrite(ledPin_a_1, HIGH);   \r\n  delay(NumberArrayFadeOutValue[0]);\r\n  SetSN74141Chips(NumberArray[0],NumberArray[4]);   \r\n  delay(NumberArrayFadeInValue[0]);\r\n  digitalWrite(ledPin_a_1, LOW);\r\n  \r\n  \/\/ Anode channel 2 - numerals 1,5\r\n  SetSN74141Chips(currNumberArray[1],currNumberArray[5]);   \r\n  digitalWrite(ledPin_a_2, HIGH);   \r\n  delay(NumberArrayFadeOutValue[1]);\r\n  SetSN74141Chips(NumberArray[1],NumberArray[5]);   \r\n  delay(NumberArrayFadeInValue[1]);\r\n  digitalWrite(ledPin_a_2, LOW);\r\n  \r\n  \/\/ Anode channel 3 - numerals 2,6\r\n  SetSN74141Chips(currNumberArray[2],currNumberArray[6]);   \r\n  digitalWrite(ledPin_a_3, HIGH);   \r\n  delay(NumberArrayFadeOutValue[2]);\r\n  SetSN74141Chips(NumberArray[2],NumberArray[6]);   \r\n  delay(NumberArrayFadeInValue[2]);\r\n  digitalWrite(ledPin_a_3, LOW);\r\n  \r\n  \/\/ Anode channel 4 - numerals 3,7\r\n  SetSN74141Chips(currNumberArray[3],currNumberArray[7]);   \r\n  digitalWrite(ledPin_a_4, HIGH);   \r\n  delay(NumberArrayFadeOutValue[3]);\r\n  SetSN74141Chips(NumberArray[3],NumberArray[7]);   \r\n  delay(NumberArrayFadeInValue[3]);\r\n  digitalWrite(ledPin_a_4, LOW);\r\n  \r\n  \/\/ Loop thru and update all the arrays, and fades.\r\n  for( int i = 0 ; i &lt; 8 ; i ++ ) \/\/equal to &amp; of digits\r\n  {\r\n    if( NumberArray[i] != currNumberArray[i] )\r\n    {\r\n      NumberArrayFadeInValue[i] += fadeStep;\r\n      NumberArrayFadeOutValue[i] -= fadeStep;\r\n  \r\n      if( NumberArrayFadeInValue[i] &gt;= fadeMax )\r\n      {\r\n        NumberArrayFadeInValue[i] = 2.0f;\r\n        NumberArrayFadeOutValue[i] = 4.0f; \/\/affects the refresh cycle\r\n        currNumberArray[i] = NumberArray[i];\r\n      }\r\n    }\r\n  }\r\n  \r\n}\r\n<\/pre>\n<p><strong>getRTCDS3231.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ DS3231 Precision RTC\r\n\/\/ Setup RTC\r\nvoid setupRTC() {\r\n\r\n  \/\/ DS3231 Precision RTC   \r\n  RTC.begin();\r\n  if (! RTC.begin() ) {\r\n    while (1) delay(10);\r\n  }\r\n\r\n  if (RTC.lostPower()) {\r\n    \r\n    \/\/ Following line sets the RTC to the date &amp; time this sketch was compiled\r\n    RTC.adjust(DateTime(F(__DATE__), F(__TIME__)));\r\n    \/\/ This line sets the RTC with an explicit date &amp; time, for example to set\r\n    \/\/ August 2, 2021 at 13:53:0 you would call:\r\n    \/\/ RTC.adjust(DateTime(2022, 4, 26, 11, 39, 0));\r\n    \r\n  }\r\n  \r\n}\r\n\/\/ Date ans Time - isTimeRTC\r\nvoid isTimeRTC() {\r\n\r\n  \/\/ Date and Time\r\n  DateTime now = RTC.now();\r\n\r\n  \/\/ Read the state of the Switch value\r\n  iRO0State = digitalRead(iRO0);\r\n  \r\n  \/\/ If it is the Switch State is HIGH\r\n  if (iRO0State == HIGH) {\r\n\r\n\r\n    \/\/ Get the high and low order values for hours, minute, seconds\r\n    int lowerHours = now.hour() % 10;\r\n    int upperHours = now.hour() - lowerHours;\r\n    int lowerMins = now.minute() % 10;\r\n    int upperMins = now.minute() - lowerMins;\r\n    int lowerSeconds = now.second() % 10;\r\n    int upperSeconds = now.second() - lowerSeconds;\r\n    \r\n    \/\/ 10 &gt;= hours, minute, seconds\r\n    if( upperSeconds &gt;= 10 )   upperSeconds = upperSeconds \/ 10;\r\n    if( upperMins &gt;= 10 )      upperMins = upperMins \/ 10;\r\n    if( upperHours &gt;= 10 )     upperHours = upperHours \/ 10;\r\n    if( upperHours == 0 &amp;&amp; lowerHours == 0 )\r\n    {\r\n      \r\n      upperHours = 1;\r\n      lowerHours = 2;\r\n      \r\n    }\r\n\r\n    \/\/ Fill in the Number array used to display on the Nixie tubes\r\n    NumberArray[7] = upperHours;\r\n    NumberArray[6] = lowerHours;\r\n    NumberArray[5] = 0;\r\n    NumberArray[4] = upperMins;\r\n    NumberArray[3] = lowerMins;\r\n    NumberArray[2] = 0;\r\n    NumberArray[1] = upperSeconds; \r\n    NumberArray[0] = lowerSeconds;\r\n\r\n  } else {\r\n\r\n    \/\/ Get the high and low order values for year, month, day\r\n    int iYear = now.year() - 2000;\r\n    int lowerYear = iYear % 10;\r\n    int upperYear = iYear - lowerYear;\r\n    int lowerMonth = now.month() % 10;\r\n    int upperMonth = now.month() - lowerMonth;\r\n    int lowerDay = now.day() % 10;\r\n    int upperDay = now.day() - lowerDay;\r\n\r\n    \/\/ 10 &gt;= year, month, day\r\n    if( upperDay &gt;= 10 )   upperDay = upperDay \/ 10;\r\n    if( upperMonth &gt;= 10 )      upperMonth = upperMonth \/ 10;\r\n    if( upperYear &gt;= 10 )     upperYear = upperYear \/ 10;\r\n\r\n    \/\/ Fill in the Number array used to display on the Nixie tubes\r\n    NumberArray[7] = 2;\r\n    NumberArray[6] = 0;\r\n    NumberArray[5] = upperYear;\r\n    NumberArray[4] = lowerYear;\r\n    NumberArray[3] = upperMonth;\r\n    NumberArray[2] = lowerMonth;\r\n    NumberArray[1] = upperDay; \r\n    NumberArray[0] = lowerDay;\r\n  \r\n  }\r\n  \r\n  \/\/ Display\r\n  DisplayFadeNumberString();\r\n  \r\n}\r\n<\/pre>\n<p><strong>getSN74141.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ SN74141\r\n\/\/ SN74141 : Truth Table\r\n\/\/D C B A #\r\n\/\/L,L,L,L 0\r\n\/\/L,L,L,H 1\r\n\/\/L,L,H,L 2\r\n\/\/L,L,H,H 3\r\n\/\/L,H,L,L 4\r\n\/\/L,H,L,H 5\r\n\/\/L,H,H,L 6\r\n\/\/L,H,H,H 7\r\n\/\/H,L,L,L 8\r\n\/\/H,L,L,H 9\r\n\/\/ isSetupSN74141\r\nvoid isSetupSN74141(){\r\n\r\n  pinMode(ledPin_0_a, OUTPUT);      \r\n  pinMode(ledPin_0_b, OUTPUT);      \r\n  pinMode(ledPin_0_c, OUTPUT);      \r\n  pinMode(ledPin_0_d, OUTPUT);    \r\n  \r\n  pinMode(ledPin_1_a, OUTPUT);      \r\n  pinMode(ledPin_1_b, OUTPUT);      \r\n  pinMode(ledPin_1_c, OUTPUT);      \r\n  pinMode(ledPin_1_d, OUTPUT);      \r\n  \r\n  pinMode(ledPin_a_1, OUTPUT);      \r\n  pinMode(ledPin_a_2, OUTPUT);      \r\n  pinMode(ledPin_a_3, OUTPUT);   \r\n  pinMode(ledPin_a_4, OUTPUT);    \r\n\r\n}\r\n\/\/ SetSN74141Chips\r\nvoid SetSN74141Chips( int num2, int num1 )\r\n{\r\n  \r\n  \/\/ Set defaults\r\n  \/\/ Will display a zero.\r\n  int a = 0;\r\n  int b = 0;\r\n  int c = 0;\r\n  int d = 0;\r\n  \r\n  \/\/ Load the a,b,c,d.. to send to the SN74141 IC (1)\r\n  switch( num1 )\r\n  {\r\n    case 0:\r\n      a=0;\r\n      b=0;\r\n      c=0;\r\n      d=0;\r\n      break;\r\n    case 1:\r\n      a=1;\r\n      b=0;\r\n      c=0;\r\n      d=0;\r\n      break;\r\n    case 2:\r\n      a=0;\r\n      b=1;\r\n      c=0;\r\n      d=0;\r\n      break;\r\n    case 3:\r\n      a=1;\r\n      b=1;\r\n      c=0;\r\n      d=0;\r\n      break;\r\n    case 4:\r\n      a=0;\r\n      b=0;\r\n      c=1;\r\n      d=0;\r\n      break;\r\n    case 5:\r\n      a=1;\r\n      b=0;\r\n      c=1;\r\n      d=0;\r\n      break;\r\n    case 6: \r\n      a=0;\r\n      b=1;\r\n      c=1;\r\n      d=0;\r\n      break;\r\n    case 7:\r\n      a=1;\r\n      b=1;\r\n      c=1;\r\n      d=0;\r\n      break;\r\n    case 8:\r\n      a=0;\r\n      b=0;\r\n      c=0;\r\n      d=1;\r\n      break;\r\n    case 9:\r\n      a=1;\r\n      b=0;\r\n      c=0;\r\n      d=1;\r\n      break;\r\n    default:\r\n      a=1;\r\n      b=1;\r\n      c=1;\r\n      d=1;\r\n      break;\r\n  }  \r\n  \r\n  \/\/ Write to output pins.\r\n  digitalWrite(ledPin_0_d, d);\r\n  digitalWrite(ledPin_0_c, c);\r\n  digitalWrite(ledPin_0_b, b);\r\n  digitalWrite(ledPin_0_a, a);\r\n\r\n  \/\/ Load the a,b,c,d.. to send to the SN74141 IC (2)\r\n  switch( num2 )\r\n  {\r\n    case 0:\r\n      a=0;\r\n      b=0;\r\n      c=0;\r\n      d=0;\r\n      break;\r\n    case 1:\r\n      a=1;\r\n      b=0;\r\n      c=0;\r\n      d=0;\r\n      break;\r\n    case 2:\r\n      a=0;\r\n      b=1;\r\n      c=0;\r\n      d=0;\r\n      break;\r\n    case 3:\r\n      a=1;\r\n      b=1;\r\n      c=0;\r\n      d=0;\r\n      break;\r\n    case 4:\r\n      a=0;\r\n      b=0;\r\n      c=1;\r\n      d=0;\r\n      break;\r\n    case 5:\r\n      a=1;\r\n      b=0;\r\n      c=1;\r\n      d=0;\r\n      break;\r\n    case 6:\r\n      a=0;\r\n      b=1;\r\n      c=1;\r\n      d=0;\r\n      break;\r\n    case 7:\r\n      a=1;\r\n      b=1;\r\n      c=1;\r\n      d=0;\r\n      break;\r\n    case 8:\r\n      a=0;\r\n      b=0;\r\n      c=0;\r\n      d=1;\r\n      break;\r\n    case 9:\r\n      a=1;\r\n      b=0;\r\n      c=0;\r\n      d=1;\r\n      break;\r\n    default:\r\n      a=1;\r\n      b=1;\r\n      c=1;\r\n      d=1;\r\n      break;\r\n  }\r\n  \r\n  \/\/ Write to output pins\r\n  digitalWrite(ledPin_1_d, d);\r\n  digitalWrite(ledPin_1_c, c);\r\n  digitalWrite(ledPin_1_b, b);\r\n  digitalWrite(ledPin_1_a, a);\r\n  \r\n}\r\n<\/pre>\n<p><strong>getStopwatch.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Stopwatch\r\n\/\/ Setup Stopwatch\r\nvoid isSetupStopwatch(){\r\n\r\n  \/\/ Switch\r\n  pinMode(iRO0, INPUT);\r\n  pinMode(iRO1, INPUT);\r\n\r\n  \/\/ Momentary Button\r\n  pinMode(iStartP, INPUT);\r\n  pinMode(iStopP, INPUT);\r\n  pinMode(iResetP, INPUT);\r\n  \r\n}\r\n\/\/ Start\r\nvoid isStart()\r\n{\r\n\r\n  \/\/ Reading buton state iStart\r\n  iStart = digitalRead(iStartP);\r\n  if(iStart == HIGH) \r\n  {\r\n\r\n    \/\/ Calls the isStopWatch function\r\n    isStopWatch();\r\n\r\n }\r\n\r\n}\r\n\/\/ Stop Watch\r\nvoid isStopWatch()\r\n{\r\n\r\n  \/\/ Miliseconds\r\n  iMS = iMS + 10;     \r\n  if(iMS == 600)           \r\n  {\r\n   \r\n    iMS = 0;\r\n    iMSS = 0;\r\n    iS = iS + 1;\r\n    \r\n  } else if (iMS == 60) { \/\/ 1\r\n\r\n    iMSS = iMSS + 1;\r\n    \r\n  } else if (iMS == 120) { \/\/ 2\r\n\r\n    iMSS = iMSS + 1;\r\n    \r\n  } else if (iMS == 180) { \/\/3 \r\n\r\n    iMSS = iMSS + 1;\r\n    \r\n  } else if (iMS == 240) { \/\/ 4\r\n\r\n    iMSS = iMSS + 1;\r\n    \r\n  } else if (iMS == 300) { \/\/ 5\r\n\r\n    iMSS = iMSS + 1;\r\n    \r\n  } else if (iMS == 360) { \/\/ 6\r\n\r\n    iMSS = iMSS + 1;\r\n    \r\n  } else if (iMS == 420) { \/\/ 7\r\n\r\n    iMSS = iMSS + 1;\r\n    \r\n  } else if (iMS == 480) { \/\/ 8\r\n\r\n    iMSS = iMSS + 1;\r\n    \r\n  } else if (iMS == 540) { \/\/ 9\r\n\r\n    iMSS = iMSS + 1;\r\n    \r\n  }\r\n  \/\/ If state for counting up minutes\r\n  if( iS == 60)\r\n  { \r\n  \r\n    iS = 0;\r\n    iM = iM + 1;\r\n    \r\n  }\r\n  \/\/ If state for counting up hours\r\n  if( iM == 60)\r\n  {  \r\n    \r\n    iM = 0;\r\n    iH = iH + 01;\r\n    \r\n  }\r\n\r\n  \/\/ Get the high and low order values for hours, minute, seconds, Miliseconds\r\n  int lowerHours = iH % 10;\r\n  int upperHours = iH - lowerHours;\r\n  int lowerMins = iM % 10;\r\n  int upperMins = iM - lowerMins;\r\n  int lowerSeconds = iS % 10;\r\n  int upperSeconds = iS - lowerSeconds;\r\n  int lowerMiliseconds = iMSS;\r\n  int upperMiliseconds = iMSS - lowerMiliseconds;\r\n    \r\n  \/\/ 10 &gt;= hours, minute, seconds, Miliseconds\r\n  if( upperSeconds &gt;= 10 )   upperSeconds = upperSeconds \/ 10;\r\n  if( upperMins &gt;= 10 )      upperMins = upperMins \/ 10;\r\n  if( upperHours &gt;= 10 )     upperHours = upperHours \/ 10;\r\n\r\n  \/\/ Fill in the Number array used to display on the Nixie tubes\r\n  NumberArray[7] = upperHours;\r\n  NumberArray[6] = lowerHours;\r\n  NumberArray[5] = upperMins;\r\n  NumberArray[4] = lowerMins;\r\n  NumberArray[3] = upperSeconds;\r\n  NumberArray[2] = lowerSeconds;\r\n  NumberArray[1] = lowerMiliseconds; \r\n  NumberArray[0] = lowerMiliseconds;\r\n\r\n  \/\/ Display\r\n  DisplayFadeNumberString();\r\n    \r\n  \/\/ Reading buton state Stop\r\n  iStop1 = digitalRead(iStopP);\r\n  \/\/ Checking if button is pressed\r\n  if(iStop1 == HIGH)\r\n  {\r\n    \r\n    \/\/ Calls the isStopwatchStop function\r\n    isStopwatchStop();\r\n    \r\n  }\r\n  else\r\n  {\r\n\r\n    \/\/ Calls the isStopWatch function\r\n    isStopWatch();\r\n    \r\n  }\r\n  \r\n}\r\n\/\/ Stopwatch Stop\r\nvoid isStopwatchStop()\r\n{\r\n\r\n  \/\/ Get the high and low order values for hours, minute, seconds, Miliseconds\r\n  int lowerHours = iH % 10;\r\n  int upperHours = iH - lowerHours;\r\n  int lowerMins = iM % 10;\r\n  int upperMins = iM - lowerMins;\r\n  int lowerSeconds = iS % 10;\r\n  int upperSeconds = iS - lowerSeconds;\r\n  int lowerMiliseconds = iMSS;\r\n  int upperMiliseconds = iMSS - lowerMiliseconds;\r\n    \r\n  \/\/ 10 &gt;= hours, minute, seconds, Miliseconds\r\n  if( upperSeconds &gt;= 10 )   upperSeconds = upperSeconds \/ 10;\r\n  if( upperMins &gt;= 10 )      upperMins = upperMins \/ 10;\r\n  if( upperHours &gt;= 10 )     upperHours = upperHours \/ 10;\r\n \r\n  \/\/ Fill in the Number array used to display on the Nixie tubes\r\n  NumberArray[7] = upperHours;\r\n  NumberArray[6] = lowerHours;\r\n  NumberArray[5] = upperMins;\r\n  NumberArray[4] = lowerMins;\r\n  NumberArray[3] = upperSeconds;\r\n  NumberArray[2] = lowerSeconds;\r\n  NumberArray[1] = lowerMiliseconds; \r\n  NumberArray[0] = lowerMiliseconds;\r\n\r\n  \/\/ Display\r\n  DisplayFadeNumberString();\r\n  \r\n  \/\/ Reading buton state iStart\r\n  iStart = digitalRead(iStartP);\r\n  if(iStart == HIGH)\r\n  {\r\n    \r\n    \/\/ Calls the isStopWatch function \r\n    isStopWatch();\r\n\r\n  } \r\n  \/\/ Reading buton state\r\n  iReset = digitalRead(iResetP);\r\n  if(iReset == HIGH)\r\n  {\r\n   \r\n     \/\/ Calls the isStopwatchReset function\r\n     isStopwatchReset();\r\n     loop();\r\n   \r\n  }\r\n  if(iReset == LOW)\r\n  {\r\n    \r\n    \/\/ Calls the isStopwatchStop function\r\n    isStopwatchStop();\r\n    \r\n  }\r\n\r\n}\r\n\/\/ Stopwatch Reset\r\nvoid isStopwatchReset()\r\n{\r\n\r\n   \/\/ Seting hours to 0\r\n   iH = 0;\r\n   \/\/ Seting minutes to 0\r\n   iM = 0;\r\n   \/\/ Seting seconds to 0\r\n   iS = 0;\r\n   \/\/ Seting miliseconds to 0\r\n   iMS = 0;\r\n   \/\/ Seting miliseconds to 0\r\n   iMSS = 0;\r\n   \r\n   \/\/ Fill in the Number array used to display on the Nixie tubes\r\n   NumberArray[7] = 0;\r\n   NumberArray[6] = 0;\r\n   NumberArray[5] = 0;\r\n   NumberArray[4] = 0;\r\n   NumberArray[3] = 0;\r\n   NumberArray[2] = 0;\r\n   NumberArray[1] = 0; \r\n   NumberArray[0] = 0;\r\n   \/\/ Display\r\n   DisplayFadeNumberString();\r\n   \/\/ Exiting the program and returning to the point where entered the program\r\n   return;\r\n   \r\n}\r\n<\/pre>\n<p><strong>setup.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Setup\r\nvoid setup() {\r\n\r\n  \/\/ isSetupSN74141\r\n  isSetupSN74141();\r\n\r\n  \/\/ Setup Stopwatch\r\n  isSetupStopwatch();\r\n\r\n  \/\/ Setup RTC\r\n  setupRTC();\r\n\r\n}\r\n<\/pre>\n<p>&#8212;&#8212;<\/p>\n<p><strong>People can contact us:<\/strong> https:\/\/www.donluc.com\/?page_id=1927<\/p>\n<p><strong>Technology Experience<\/strong><\/p>\n<ul>\n<li>Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc&#8230;)<\/li>\n<li>IoT<\/li>\n<li>Robotics<\/li>\n<li>Camera and Video Capture Receiver Stationary, Wheel\/Tank and Underwater Vehicle<\/li>\n<li>Unmanned Vehicles Terrestrial and Marine<\/li>\n<li>Research &#038; Development (R &#038; D)<\/li>\n<\/ul>\n<p><strong>Instructor and E-Mentor<\/strong><\/p>\n<ul>\n<li>IoT<\/li>\n<li>PIC Microcontrollers<\/li>\n<li>Arduino<\/li>\n<li>Raspberry Pi<\/li>\n<li>Espressif<\/li>\n<li>Robotics<\/li>\n<\/ul>\n<p><strong>Follow Us<\/strong><\/p>\n<p><strong>J. Luc Paquin \u2013 Curriculum Vitae &#8211; 2022 English &#038; Espa\u00f1ol<\/strong><br \/>\nhttps:\/\/www.jlpconsultants.com\/luc\/<\/p>\n<p><strong>Web:<\/strong> https:\/\/www.donluc.com\/<br \/>\n<strong>Web:<\/strong> https:\/\/www.jlpconsultants.com\/<br \/>\n<strong>Facebook:<\/strong> https:\/\/www.facebook.com\/neosteam.labs.9\/<br \/>\n<strong>YouTube:<\/strong> https:\/\/www.youtube.com\/channel\/UC5eRjrGn1CqkkGfZy0jxEdA<br \/>\n<strong>Twitter:<\/strong> https:\/\/twitter.com\/labs_steam<br \/>\n<strong>Pinterest:<\/strong> https:\/\/www.pinterest.com\/NeoSteamLabs\/<br \/>\n<strong>Instagram:<\/strong> https:\/\/www.instagram.com\/neosteamlabs\/<\/p>\n<p><strong>Don Luc<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8212;&#8212; #DonLucElectronics #DonLuc #NixieTube #Nixie #ArduiNIX #ArduinoMega2560 #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; Stopwatch A stopwatch is a timepiece designed to measure the amount of time that elapses between its activation and deactivation. In manual timing, the clock is started and stopped by a person pressing a button. The timing &#8230; <a title=\"Project #21 &#8211; Nixie &#8211; Stopwatch &#8211; Mk04\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=3213\" aria-label=\"Read more about Project #21 &#8211; Nixie &#8211; Stopwatch &#8211; Mk04\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[197,47,50,49,38,59,5,69,58,10,43],"tags":[86,6,102,4,19,85,24,237,9,27,109,241,33,34],"class_list":["post-3213","post","type-post","status-publish","format-standard","hentry","category-nixie","category-adafruit","category-arduino","category-consultant","category-digitalelectronics","category-fritzing","category-microcontrollers","category-nixie-clock","category-arduino-programming","category-projects","category-sparkfun","tag-adafruit","tag-arduino","tag-components","tag-consultant","tag-electronics","tag-fritzing","tag-microcontroller","tag-nixie-tube","tag-programming","tag-projects-2","tag-sparkfun","tag-stopwatch","tag-technology","tag-video-blog"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3213"}],"version-history":[{"count":2,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3213\/revisions"}],"predecessor-version":[{"id":3987,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3213\/revisions\/3987"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}