Advertisement
pleasedontcode

GPSTime rev_07

Oct 18th, 2023
91
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-10-18 20:30:05
  15.     - Source Code generated by: Francesco Alessandro
  16.  
  17. ********* Pleasedontcode.com **********/
  18. /****** DEFINITION OF LIBRARIES *****/
  19. #include <Arduino.h>
  20. #include <Wire.h>
  21. #include <SoftwareSerial.h>
  22. #include <LiquidCrystal_I2C.h>
  23. #include <MicroNMEA.h>
  24.  
  25. /****** SYSTEM REQUIREMENT 1 *****/
  26. /* Reads NMEA 8bit data from GPS module. Reads hours */
  27. /* minutes, seconds and Display h, m, s on 6x 7seg */
  28. /* LED display. When mins and secs are 00 00, */
  29. /* contact closure for about 1 sec. */
  30.  
  31. /****** FUNCTION PROTOTYPES *****/
  32. void setup(void);
  33. void loop(void);
  34. void readGPSData(void);
  35. void displayTimeOnLED(uint8_t hours, uint8_t minutes, uint8_t seconds);
  36. void triggerContactClosure(void);
  37.  
  38. /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
  39. const uint8_t contactClosure_PIN_D2 = 2;
  40.  
  41. /***** DEFINITION OF Software Serial *****/
  42. const uint8_t gpsSerial_PIN_SERIAL_TX_A1 = A1;
  43. const uint8_t gpsSerial_PIN_SERIAL_RX_A0 = A0;
  44. SoftwareSerial gpsSerial(gpsSerial_PIN_SERIAL_RX_A0, gpsSerial_PIN_SERIAL_TX_A1);
  45.  
  46. /***** DEFINITION OF I2C PINS *****/
  47. const uint8_t display_LCD1602I2C_I2C_PIN_SDA_A4 = A4;
  48. const uint8_t display_LCD1602I2C_I2C_PIN_SCL_A5 = A5;
  49. const uint8_t display_LCD1602I2C_I2C_SLAVE_ADDRESS = 39;
  50.  
  51. void setup(void)
  52. {
  53.   pinMode(contactClosure_PIN_D2, OUTPUT);
  54.  
  55.   gpsSerial.begin(9600);
  56.  
  57.   // Initialize your 6x 7-segment LED display here
  58. }
  59.  
  60. void loop(void)
  61. {
  62.   readGPSData();
  63. }
  64.  
  65. void readGPSData(void)
  66. {
  67.   while (gpsSerial.available())
  68.   {
  69.     char c = gpsSerial.read();
  70.     // Process the received NMEA data here
  71.   }
  72. }
  73.  
  74. void displayTimeOnLED(uint8_t hours, uint8_t minutes, uint8_t seconds)
  75. {
  76.   // Display the hours, minutes, and seconds on your 6x 7-segment LED display here
  77. }
  78.  
  79. void triggerContactClosure(void)
  80. {
  81.   digitalWrite(contactClosure_PIN_D2, HIGH);
  82.   delay(1000);
  83.   digitalWrite(contactClosure_PIN_D2, LOW);
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement