/********* Pleasedontcode.com ********** Pleasedontcode thanks you for automatic code generation! Enjoy your code! - Terms and Conditions: You have a non-exclusive, revocable, worldwide, royalty-free license for personal and commercial use. Attribution is optional; modifications are allowed, but you're responsible for code maintenance. We're not liable for any loss or damage. For full terms, please visit pleasedontcode.com/termsandconditions. - Project: GPSTime - Source Code compiled for: Arduino Uno - Source Code created on: 2023-11-20 16:23:35 - Source Code generated by: Francesco Alessandro ********* Pleasedontcode.com **********/ /****** DEFINITION OF LIBRARIES *****/ #include #include #include #include #include const uint8_t contactClosure_PIN_D7 = 7; const uint8_t NEO_6M_GPS_module_PIN_SERIAL_TX_A0 = A0; const uint8_t NEO_6M_GPS_module_PIN_SERIAL_RX_A1 = A1; SoftwareSerial NEO_6M_GPS_module(NEO_6M_GPS_module_PIN_SERIAL_RX_A1, NEO_6M_GPS_module_PIN_SERIAL_TX_A0); LiquidCrystal_I2C lcd(0x27, 16, 2); MicroNMEA nmea; void setup(void) { pinMode(contactClosure_PIN_D7, OUTPUT); NEO_6M_GPS_module.begin(9600); lcd.begin(16, 2); lcd.setCursor(0, 0); lcd.print("Initializing..."); delay(2000); lcd.clear(); lcd.setCursor(0, 0); lcd.print("GPS Module Ready"); } void loop(void) { if (NEO_6M_GPS_module.available()) { readGPSData(); displayTimeOnLCD(); } } void readGPSData(void) { while (NEO_6M_GPS_module.available()) { char c = NEO_6M_GPS_module.read(); nmea.process(c); } } void displayTimeOnLCD(void) { if (nmea.isValid() && nmea.getHour() && nmea.getMinute() && nmea.getSecond()) { lcd.clear(); lcd.setCursor(0, 0); lcd.print("Time: "); lcd.print(nmea.getHour()); lcd.print(":"); lcd.print(nmea.getMinute()); lcd.print(":"); lcd.print(nmea.getSecond()); if (nmea.getHour() == 0 && nmea.getMinute() == 0 && nmea.getSecond() == 0) { digitalWrite(contactClosure_PIN_D7, HIGH); delay(1000); digitalWrite(contactClosure_PIN_D7, LOW); } } }