{\rtf1\ansi\ansicpg1252\cocoartf2761 \cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 Menlo-Regular;} {\colortbl;\red255\green255\blue255;\red22\green145\blue149;\red24\green29\blue31;\red210\green220\blue220; \red110\green193\blue194;\red183\green111\blue179;\red238\green138\blue18;\red108\green121\blue122;} {\*\expandedcolortbl;;\cssrgb\c4706\c63137\c65098;\cssrgb\c12157\c15294\c16471;\cssrgb\c85490\c89020\c89020; \cssrgb\c49804\c79608\c80392;\cssrgb\c77255\c52549\c75294;\cssrgb\c95294\c61176\c7059;\cssrgb\c49804\c54902\c55294;} \margl1440\margr1440\vieww11520\viewh8400\viewkind0 \deftab720 \pard\pardeftab720\partightenfactor0 \f0\fs24 \cf2 \cb3 \expnd0\expndtw0\kerning0 \outl0\strokewidth0 \strokec2 int\cf4 \strokec4 LED_BUILTIN = \cf5 \strokec5 2\cf4 \strokec4 ;\cb1 \ \pard\pardeftab720\partightenfactor0 \cf6 \cb3 \strokec6 #include\cf4 \strokec4 \cf5 \strokec5 \cf4 \cb1 \strokec4 \ \cf6 \cb3 \strokec6 #include\cf4 \strokec4 \cf5 \strokec5 \cf4 \cb1 \strokec4 \ \cf6 \cb3 \strokec6 #include\cf4 \strokec4 \cf5 \strokec5 \cf4 \cb1 \strokec4 \ \cf6 \cb3 \strokec6 #include\cf4 \strokec4 \cf5 \strokec5 \cf4 \cb1 \strokec4 \ \cf6 \cb3 \strokec6 #include\cf4 \strokec4 \cf5 \strokec5 \cf4 \cb1 \strokec4 \ \ \pard\pardeftab720\partightenfactor0 \cf4 \cb3 Adafruit_PCD8544 display = \cf7 \strokec7 Adafruit_PCD8544\cf4 \strokec4 (\cf5 \strokec5 5\cf4 \strokec4 , \cf5 \strokec5 23\cf4 \strokec4 , \cf5 \strokec5 4\cf4 \strokec4 , \cf5 \strokec5 15\cf4 \strokec4 , \cf5 \strokec5 2\cf4 \strokec4 );\cb1 \ \ \ \pard\pardeftab720\partightenfactor0 \cf2 \cb3 \strokec2 bool\cf4 \strokec4 object_placed = \cf5 \strokec5 false\cf4 \strokec4 ;\cb1 \ \cf2 \cb3 \strokec2 int\cf4 \strokec4 contrastValue = \cf5 \strokec5 60\cf4 \strokec4 ;\cb1 \ \cf2 \cb3 \strokec2 const\cf4 \strokec4 \cf2 \strokec2 int\cf4 \strokec4 adcPin = \cf5 \strokec5 34\cf4 \strokec4 ;\cb1 \ \cf2 \cb3 \strokec2 int\cf4 \strokec4 adcValue = \cf5 \strokec5 0\cf4 \strokec4 ;\cb1 \ \cf2 \cb3 \strokec2 const\cf4 \strokec4 \cf2 \strokec2 float\cf4 \strokec4 VCC = \cf5 \strokec5 3.3\cf4 \strokec4 ;\cb1 \ \cf2 \cb3 \strokec2 const\cf4 \strokec4 \cf2 \strokec2 float\cf4 \strokec4 R_DIV = \cf5 \strokec5 4660.0\cf4 \strokec4 ;\cb1 \ \cf2 \cb3 \strokec2 const\cf4 \strokec4 \cf2 \strokec2 float\cf4 \strokec4 DARK_THRESHOLD = \cf5 \strokec5 10000.0\cf4 \strokec4 ;\cb1 \ \cf2 \cb3 \strokec2 const\cf4 \strokec4 \cf2 \strokec2 int\cf4 \strokec4 fiveminPin = \cf5 \strokec5 25\cf4 \strokec4 ;\cb1 \ \cf2 \cb3 \strokec2 const\cf4 \strokec4 \cf2 \strokec2 int\cf4 \strokec4 tenminPin = \cf5 \strokec5 26\cf4 \strokec4 ;\cb1 \ \cf2 \cb3 \strokec2 const\cf4 \strokec4 \cf2 \strokec2 int\cf4 \strokec4 decrePin = \cf5 \strokec5 27\cf4 \strokec4 ;\cb1 \ \cf2 \cb3 \strokec2 const\cf4 \strokec4 \cf2 \strokec2 int\cf4 \strokec4 increPin = \cf5 \strokec5 12\cf4 \strokec4 ; \cb1 \ \cf2 \cb3 \strokec2 const\cf4 \strokec4 \cf2 \strokec2 int\cf4 \strokec4 LEDPin = \cf5 \strokec5 22\cf4 \strokec4 ;\cb1 \ \cf2 \cb3 \strokec2 int\cf4 \strokec4 pwmPin = \cf5 \strokec5 18\cf4 \strokec4 ;\cf8 \strokec8 // GPIO 18\cf4 \cb1 \strokec4 \ \cf2 \cb3 \strokec2 int\cf4 \strokec4 pwmChannel = \cf5 \strokec5 0\cf4 \strokec4 ;\cf8 \strokec8 // PWM channel 0\cf4 \cb1 \strokec4 \ \cf2 \cb3 \strokec2 int\cf4 \strokec4 pwmResolution = \cf5 \strokec5 8\cf4 \strokec4 ;\cf8 \strokec8 // 8-bit resolution\cf4 \cb1 \strokec4 \ \cf2 \cb3 \strokec2 int\cf4 \strokec4 dutyCycle = \cf5 \strokec5 128\cf4 \strokec4 ;\cf8 \strokec8 // 50% duty cycle (128 out of 255)\cf4 \cb1 \strokec4 \ \cf2 \cb3 \strokec2 long\cf4 \strokec4 duration;\cb1 \ \cf2 \cb3 \strokec2 long\cf4 \strokec4 distance;\cb1 \ \ \cf2 \cb3 \strokec2 void\cf4 \strokec4 \cf7 \strokec7 setup\cf4 \strokec4 ()\cb1 \ \pard\pardeftab720\partightenfactor0 \cf4 \cb3 \{\cb1 \ \cb3 \cf7 \strokec7 pinMode\cf4 \strokec4 (adcPin, INPUT);\cb1 \ \cb3 \cf7 \strokec7 ledcAttach\cf4 \strokec4 (pwmPin, \cf5 \strokec5 440\cf4 \strokec4 , pwmResolution);\cb1 \ \pard\pardeftab720\partightenfactor0 \cf8 \cb3 \strokec8 // Intialize all pin values and outputs/inputs\cf4 \cb1 \strokec4 \ \pard\pardeftab720\partightenfactor0 \cf4 \cb3 \cf7 \strokec7 pinMode\cf4 \strokec4 (fiveminPin, INPUT_PULLDOWN);\cb1 \ \cb3 \cf7 \strokec7 pinMode\cf4 \strokec4 (tenminPin, INPUT_PULLDOWN);\cb1 \ \cb3 \cf7 \strokec7 pinMode\cf4 \strokec4 (decrePin, INPUT_PULLDOWN);\cb1 \ \cb3 \cf7 \strokec7 pinMode\cf4 \strokec4 (increPin, INPUT_PULLDOWN);\cb1 \ \cb3 \cf7 \strokec7 pinMode\cf4 \strokec4 (LED_BUILTIN, OUTPUT);\cb1 \ \cb3 \cf7 \strokec7 pinMode\cf4 \strokec4 (LEDPin, OUTPUT);\cb1 \ \cb3 \cf7 \strokec7 Serial\cf4 \strokec4 .\cf7 \strokec7 begin\cf4 \strokec4 (\cf5 \strokec5 9600\cf4 \strokec4 );\cb1 \ \ \pard\pardeftab720\partightenfactor0 \cf8 \cb3 \strokec8 // intialize display\cf4 \cb1 \strokec4 \ \pard\pardeftab720\partightenfactor0 \cf4 \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 begin\cf4 \strokec4 ();\cb1 \ \ \pard\pardeftab720\partightenfactor0 \cf8 \cb3 \strokec8 // set contrast value for display\cf4 \cb1 \strokec4 \ \pard\pardeftab720\partightenfactor0 \cf4 \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setContrast\cf4 \strokec4 (contrastValue);\cb1 \ \ \pard\pardeftab720\partightenfactor0 \cf8 \cb3 \strokec8 // clear the display buffer\cf4 \cb1 \strokec4 \ \pard\pardeftab720\partightenfactor0 \cf4 \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 clearDisplay\cf4 \strokec4 ();\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 display\cf4 \strokec4 ();\cb1 \ \cb3 \cf7 \strokec7 delay\cf4 \strokec4 (\cf5 \strokec5 1000\cf4 \strokec4 );\cb1 \ \cb3 \cb1 \ \pard\pardeftab720\partightenfactor0 \cf8 \cb3 \strokec8 /* Now let us display some text */\cf4 \cb1 \strokec4 \ \pard\pardeftab720\partightenfactor0 \cf4 \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setTextColor\cf4 \strokec4 (WHITE, BLACK);\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setCursor\cf4 \strokec4 (\cf5 \strokec5 0\cf4 \strokec4 ,\cf5 \strokec5 1\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setTextSize\cf4 \strokec4 (\cf5 \strokec5 2\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 println\cf4 \strokec4 (\cf5 \strokec5 "|ESP32|"\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setTextSize\cf4 \strokec4 (\cf5 \strokec5 1\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setTextColor\cf4 \strokec4 (BLACK);\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setCursor\cf4 \strokec4 (\cf5 \strokec5 22\cf4 \strokec4 ,\cf5 \strokec5 20\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 println\cf4 \strokec4 (\cf5 \strokec5 "|Nokia|"\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setCursor\cf4 \strokec4 (\cf5 \strokec5 22\cf4 \strokec4 ,\cf5 \strokec5 32\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 println\cf4 \strokec4 (\cf5 \strokec5 "|5110|"\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 display\cf4 \strokec4 ();\cb1 \ \cb3 \cf7 \strokec7 delay\cf4 \strokec4 (\cf5 \strokec5 2000\cf4 \strokec4 );\cb1 \ \cb3 \}\cb1 \ \ \pard\pardeftab720\partightenfactor0 \cf2 \cb3 \strokec2 void\cf4 \strokec4 \cf7 \strokec7 loop\cf4 \strokec4 () \{\cb1 \ \pard\pardeftab720\partightenfactor0 \cf4 \cb3 \cf7 \strokec7 digitalWrite\cf4 \strokec4 (LED_BUILTIN, HIGH);\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 clearDisplay\cf4 \strokec4 ();\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setTextColor\cf4 \strokec4 (WHITE, BLACK);\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setTextSize\cf4 \strokec4 (\cf5 \strokec5 1\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setTextColor\cf4 \strokec4 (BLACK);\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setCursor\cf4 \strokec4 (\cf5 \strokec5 6\cf4 \strokec4 ,\cf5 \strokec5 4\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 println\cf4 \strokec4 (\cf5 \strokec5 "Place object"\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setCursor\cf4 \strokec4 (\cf5 \strokec5 12\cf4 \strokec4 , \cf5 \strokec5 20\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 println\cf4 \strokec4 (\cf5 \strokec5 "and then"\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setCursor\cf4 \strokec4 (\cf5 \strokec5 0\cf4 \strokec4 , \cf5 \strokec5 36\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 println\cf4 \strokec4 (\cf5 \strokec5 "set your timer"\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 display\cf4 \strokec4 ();\cb1 \ \cb3 \cf7 \strokec7 delay\cf4 \strokec4 (\cf5 \strokec5 1000\cf4 \strokec4 );\cb1 \ \ \cb3 \cf2 \strokec2 float\cf4 \strokec4 lightR = \cf5 \strokec5 0\cf4 \strokec4 ;\cb1 \ \cb3 \cf2 \strokec2 float\cf4 \strokec4 lightV = \cf5 \strokec5 0\cf4 \strokec4 ;\cb1 \ \cb3 \cf2 \strokec2 int\cf4 \strokec4 lightADC = \cf7 \strokec7 analogRead\cf4 \strokec4 (adcPin);\cb1 \ \cb3 \cf6 \strokec6 if\cf4 \strokec4 (lightADC > \cf5 \strokec5 0\cf4 \strokec4 ) \{\cb1 \ \cb3 lightV = lightADC * VCC/\cf5 \strokec5 4095.0\cf4 \strokec4 ;\cb1 \ \cb3 lightR = R_DIV * (VCC / lightV - \cf5 \strokec5 1.0\cf4 \strokec4 );\cb1 \ \ \cb3 \}\cb1 \ \ \cb3 \cf7 \strokec7 Serial\cf4 \strokec4 .\cf7 \strokec7 printf\cf4 \strokec4 (\cf5 \strokec5 "Voltage from photoresistor: "\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 Serial\cf4 \strokec4 .\cf7 \strokec7 println\cf4 \strokec4 (lightADC);\cb1 \ \cb3 \cf7 \strokec7 Serial\cf4 \strokec4 .\cf7 \strokec7 println\cf4 \strokec4 (lightR);\cb1 \ \cb3 \cf7 \strokec7 Serial\cf4 \strokec4 .\cf7 \strokec7 println\cf4 \strokec4 (lightV);\cb1 \ \cb3 \cf7 \strokec7 Serial\cf4 \strokec4 .\cf7 \strokec7 printf\cf4 \strokec4 (\cf5 \strokec5 "set Five minute time is:"\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 Serial\cf4 \strokec4 .\cf7 \strokec7 println\cf4 \strokec4 (\cf7 \strokec7 digitalRead\cf4 \strokec4 (fiveminPin));\cb1 \ \cb3 \cf7 \strokec7 Serial\cf4 \strokec4 .\cf7 \strokec7 printf\cf4 \strokec4 (\cf5 \strokec5 "set Ten Minue pin is: "\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 Serial\cf4 \strokec4 .\cf7 \strokec7 println\cf4 \strokec4 (\cf7 \strokec7 digitalRead\cf4 \strokec4 (tenminPin));\cb1 \ \pard\pardeftab720\partightenfactor0 \cf8 \cb3 \strokec8 // This will act as a notifier for an object being close to the sensor, like our system should\cf4 \cb1 \strokec4 \ \pard\pardeftab720\partightenfactor0 \cf4 \cb3 \cb1 \ \ \cb3 \cf6 \strokec6 if\cf4 \strokec4 (lightV <= \cf5 \strokec5 0.30\cf4 \strokec4 ) object_placed = \cf5 \strokec5 true\cf4 \strokec4 ;\cb1 \ \cb3 \cf6 \strokec6 else\cf4 \strokec4 object_placed = \cf5 \strokec5 false\cf4 \strokec4 ;\cb1 \ \ \cb3 \cf7 \strokec7 delay\cf4 \strokec4 (\cf5 \strokec5 100\cf4 \strokec4 );\cb1 \ \ \cb3 \cf6 \strokec6 if\cf4 \strokec4 ((object_placed && (\cf7 \strokec7 digitalRead\cf4 \strokec4 (fiveminPin) == \cf5 \strokec5 1\cf4 \strokec4 || \cf7 \strokec7 digitalRead\cf4 \strokec4 (tenminPin) == \cf5 \strokec5 1\cf4 \strokec4 )) == \cf5 \strokec5 true\cf4 \strokec4 ) \{\cb1 \ \cb3 \cf2 \strokec2 bool\cf4 \strokec4 break_timer = \cf5 \strokec5 false\cf4 \strokec4 ;\cb1 \ \cb3 \cf2 \strokec2 int\cf4 \strokec4 time_left = \cf5 \strokec5 1\cf4 \strokec4 ;\cb1 \ \cb3 \cf6 \strokec6 if\cf4 \strokec4 (\cf7 \strokec7 digitalRead\cf4 \strokec4 (fiveminPin)) time_left = \cf5 \strokec5 300000\cf4 \strokec4 ;\cb1 \ \cb3 \cf6 \strokec6 else\cf4 \strokec4 \cf6 \strokec6 if\cf4 \strokec4 (\cf7 \strokec7 digitalRead\cf4 \strokec4 (tenminPin)) time_left = \cf5 \strokec5 600000\cf4 \strokec4 ;\cb1 \ \ \cb3 \cf6 \strokec6 while\cf4 \strokec4 (time_left != \cf5 \strokec5 0\cf4 \strokec4 ) \{\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 clearDisplay\cf4 \strokec4 ();\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setTextColor\cf4 \strokec4 (BLACK);\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setTextSize\cf4 \strokec4 (\cf5 \strokec5 1\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setCursor\cf4 \strokec4 (\cf5 \strokec5 0\cf4 \strokec4 , \cf5 \strokec5 0\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 println\cf4 \strokec4 (\cf5 \strokec5 "Time Remaining"\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 Serial\cf4 \strokec4 .\cf7 \strokec7 println\cf4 \strokec4 (((\cf7 \strokec7 analogRead\cf4 \strokec4 (adcPin))*VCC)/\cf5 \strokec5 4095.0\cf4 \strokec4 );\cb1 \ \cb3 \cb1 \ \cb3 \cf7 \strokec7 delay\cf4 \strokec4 (\cf5 \strokec5 1000\cf4 \strokec4 );\cb1 \ \cb3 time_left -= \cf5 \strokec5 1000\cf4 \strokec4 ;\cb1 \ \ \cb3 \cf2 \strokec2 double\cf4 \strokec4 raw_minutes = time_left/\cf5 \strokec5 60000\cf4 \strokec4 ;\cb1 \ \cb3 \cf2 \strokec2 int\cf4 \strokec4 minutes = \cf7 \strokec7 floor\cf4 \strokec4 (raw_minutes);\cb1 \ \cb3 \cf2 \strokec2 int\cf4 \strokec4 seconds = ((time_left)/\cf5 \strokec5 1000\cf4 \strokec4 ) % \cf5 \strokec5 60\cf4 \strokec4 ;\cb1 \ \cb3 \cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setCursor\cf4 \strokec4 (\cf5 \strokec5 28\cf4 \strokec4 ,\cf5 \strokec5 16\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 print\cf4 \strokec4 (minutes);\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 print\cf4 \strokec4 (\cf5 \strokec5 ":"\cf4 \strokec4 );\cb1 \ \cb3 \cf6 \strokec6 if\cf4 \strokec4 (seconds < \cf5 \strokec5 10\cf4 \strokec4 ) \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 print\cf4 \strokec4 (\cf5 \strokec5 "0"\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 print\cf4 \strokec4 (seconds);\cb1 \ \cb3 \cf7 \strokec7 Serial\cf4 \strokec4 .\cf7 \strokec7 println\cf4 \strokec4 (time_left);\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 display\cf4 \strokec4 ();\cb1 \ \cb3 \cb1 \ \cb3 \cf6 \strokec6 if\cf4 \strokec4 (\cf7 \strokec7 digitalRead\cf4 \strokec4 (increPin) == \cf5 \strokec5 1\cf4 \strokec4 ) \{\cb1 \ \cb3 time_left += \cf5 \strokec5 30000\cf4 \strokec4 ;\cb1 \ \cb3 \}\cb1 \ \cb3 \cf6 \strokec6 else\cf4 \strokec4 \cf6 \strokec6 if\cf4 \strokec4 (\cf7 \strokec7 digitalRead\cf4 \strokec4 (decrePin) == \cf5 \strokec5 1\cf4 \strokec4 ) \{\cb1 \ \cb3 \cf6 \strokec6 if\cf4 \strokec4 (time_left <= \cf5 \strokec5 30000\cf4 \strokec4 ) \{\cb1 \ \cb3 \cf6 \strokec6 continue\cf4 \strokec4 ;\cb1 \ \cb3 \}\cb1 \ \cb3 \cf6 \strokec6 else\cf4 \strokec4 \{ \cb1 \ \cb3 time_left -= \cf5 \strokec5 30000\cf4 \strokec4 ;\cb1 \ \cb3 \}\cb1 \ \cb3 \}\cb1 \ \cb3 \cf6 \strokec6 if\cf4 \strokec4 (((\cf7 \strokec7 analogRead\cf4 \strokec4 (adcPin))*VCC)/\cf5 \strokec5 4095.0\cf4 \strokec4 >= \cf5 \strokec5 0.30\cf4 \strokec4 ) \{\cb1 \ \cb3 break_timer = \cf5 \strokec5 true\cf4 \strokec4 ;\cb1 \ \cb3 \cf6 \strokec6 break\cf4 \strokec4 ;\cb1 \ \cb3 \}\cb1 \ \cb3 \}\cb1 \ \cb3 \cf2 \strokec2 int\cf4 \strokec4 i = \cf5 \strokec5 0\cf4 \strokec4 ;\cb1 \ \cb3 \cf7 \strokec7 Serial\cf4 \strokec4 .\cf7 \strokec7 printf\cf4 \strokec4 (\cf5 \strokec5 "The timer has finished!"\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 ledcWrite\cf4 \strokec4 (pwmPin, dutyCycle);\cb1 \ \cb3 \cf6 \strokec6 for\cf4 \strokec4 (i; i < \cf5 \strokec5 5\cf4 \strokec4 ; i++)\{\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 clearDisplay\cf4 \strokec4 ();\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 display\cf4 \strokec4 ();\cb1 \ \cb3 \cf7 \strokec7 delay\cf4 \strokec4 (\cf5 \strokec5 1000\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 clearDisplay\cf4 \strokec4 ();\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setTextColor\cf4 \strokec4 (BLACK);\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setTextSize\cf4 \strokec4 (\cf5 \strokec5 1\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 setCursor\cf4 \strokec4 (\cf5 \strokec5 0\cf4 \strokec4 , \cf5 \strokec5 1\cf4 \strokec4 );\cb1 \ \cb3 \cf6 \strokec6 if\cf4 \strokec4 (break_timer == \cf5 \strokec5 true\cf4 \strokec4 ) \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 println\cf4 \strokec4 (\cf5 \strokec5 "Object Removed"\cf4 \strokec4 );\cb1 \ \cb3 \cf6 \strokec6 else\cf4 \strokec4 \cf6 \strokec6 if\cf4 \strokec4 (break_timer == \cf5 \strokec5 false\cf4 \strokec4 ) \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 println\cf4 \strokec4 (\cf5 \strokec5 "Timer Finished"\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 display\cf4 \strokec4 .\cf7 \strokec7 display\cf4 \strokec4 ();\cb1 \ \cb3 \cf7 \strokec7 delay\cf4 \strokec4 (\cf5 \strokec5 1000\cf4 \strokec4 );\cb1 \ \cb3 \}\cb1 \ \cb3 \cf7 \strokec7 ledcWrite\cf4 \strokec4 (pwmPin, \cf5 \strokec5 0\cf4 \strokec4 );\cb1 \ \cb3 \cf7 \strokec7 digitalWrite\cf4 \strokec4 (LEDPin, LOW);\cb1 \ \cb3 \}\cb1 \ \ \cb3 \}\cb1 \ \ }