Advertisement
pleasedontcode

GPSTime rev_118

Nov 24th, 2023
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /********* Pleasedontcode.com **********
  2.  
  3.     Pleasedontcode thanks you for automatic code generation! Enjoy your code!
  4.  
  5.     - Terms and Conditions:
  6.     You have a non-exclusive, revocable, worldwide, royalty-free license
  7.     for personal and commercial use. Attribution is optional; modifications
  8.     are allowed, but you're responsible for code maintenance. We're not
  9.     liable for any loss or damage. For full terms,
  10.     please visit pleasedontcode.com/termsandconditions.
  11.  
  12.     - Project: GPSTime
  13.     - Source Code compiled for: Arduino Uno
  14.     - Source Code created on: 2023-11-25 00:08:38
  15.     - Source Code generated by: Francesco Alessandro
  16.  
  17. ********* Pleasedontcode.com **********/
  18. /****** DEFINITION OF LIBRARIES *****/
  19. #include <Arduino.h>
  20. #include <SoftwareSerial.h>
  21. #include <Wire.h>
  22. #include <MicroNMEA.h>
  23. #include <LiquidCrystal_I2C.h>
  24.  
  25. /****** SYSTEM REQUIREMENT 1 *****/
  26. /* Reads hour, minutes and seconds from GPS */
  27. /* module using MicroNMEA library. Display hours, */
  28. /* minutes and seconds on 6x 7seg LED display. When */
  29. /* mins and secs are 00 00, contact closure for about */
  30. /* 1 sec. */
  31.  
  32. /****** FUNCTION PROTOTYPES *****/
  33. void setup(void);
  34. void loop(void);
  35.  
  36. /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
  37. const uint8_t contactClosure_PIN_D7 = 7;
  38.  
  39. /***** DEFINITION OF Software Serial *****/
  40. const uint8_t NEO_6M_GPS_module_PIN_SERIAL_TX_A0 = A0;
  41. const uint8_t NEO_6M_GPS_module_PIN_SERIAL_RX_A1 = A1;
  42. SoftwareSerial NEO_6M_GPS_module(NEO_6M_GPS_module_PIN_SERIAL_RX_A1, NEO_6M_GPS_module_PIN_SERIAL_TX_A0);
  43.  
  44. /***** DEFINITION OF I2C PINS *****/
  45. const uint8_t lcd_LCD1602I2C_I2C_PIN_SDA_A4 = A4;
  46. const uint8_t lcd_LCD1602I2C_I2C_PIN_SCL_A5 = A5;
  47. const uint8_t lcd_LCD1602I2C_I2C_SLAVE_ADDRESS = 39;
  48.  
  49. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  50. MicroNMEA nmea;
  51. LiquidCrystal_I2C lcd(lcd_LCD1602I2C_I2C_SLAVE_ADDRESS, 20, 4); // Initialize the LiquidCrystal_I2C object
  52.  
  53. void setup(void)
  54. {
  55.   // put your setup code here, to run once:
  56.  
  57.   pinMode(contactClosure_PIN_D7, OUTPUT);
  58.  
  59.   NEO_6M_GPS_module.begin(9600);
  60.  
  61.   // Initialize the LCD
  62.   lcd.init();
  63.   lcd.backlight();
  64.   // Add additional setup code for System Requirement 1 here
  65. }
  66.  
  67. void loop(void)
  68. {
  69.   // put your main code here, to run repeatedly:
  70.  
  71.   // Add code to read hour, minutes, and seconds from GPS module using MicroNMEA library
  72.   // Uncomment and replace the placeholders with the actual code.
  73.   //  int hours = nmea.getHours();
  74.   //  int minutes = nmea.getMinutes();
  75.   //  int seconds = nmea.getSeconds();
  76.  
  77.   // Display hours, minutes, and seconds on 6x 7seg LED display
  78.   // Uncomment and replace the placeholders with the actual code.
  79.   //  displaySevenSegment(hours);
  80.   //  displaySevenSegment(minutes);
  81.   //  displaySevenSegment(seconds);
  82.  
  83.   // Check if minutes and seconds are 00:00, if true, activate contact closure for about 1 second
  84.   // Uncomment and replace the placeholders with the actual code.
  85.   //  if (minutes == 0 && seconds == 0) {
  86.   //    activateContactClosure();
  87.   //  }
  88.  
  89.   delay(1000); // Delay for 1 second before the next iteration
  90. }
  91.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement