Advertisement
pleasedontcode

Scanner rev_42

Oct 29th, 2023
59
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: Scanner
  13.     - Source Code compiled for: Arduino Uno
  14.     - Source Code created on: 2023-10-29 15:10:29
  15.     - Source Code generated by: AlexWind
  16.  
  17. ********* Pleasedontcode.com **********/
  18. /****** DEFINITION OF LIBRARIES *****/
  19. #include <Arduino.h>
  20. #include <SoftwareSerial.h>
  21. #include <LiquidCrystal_I2C.h>
  22. #include <MicroNMEA.h>
  23.  
  24. /****** SYSTEM REQUIREMENT 1 *****/
  25. /* Reads NMEA 8bit data from GPS module. Reads hours */
  26. /* minutes, seconds and Display h, m, s on LED */
  27. /* display. When mins and secs are 00 00, contact */
  28. /* closure for about 1 sec. */
  29.  
  30. /****** FUNCTION PROTOTYPES *****/
  31. void setup(void);
  32. void loop(void);
  33.  
  34. /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
  35. const uint8_t contactClosure_PIN_D2 = 2;
  36.  
  37. /***** DEFINITION OF Software Serial *****/
  38. const uint8_t gpsSerial_PIN_SERIAL_TX_A1 = A1;
  39. const uint8_t gpsSerial_PIN_SERIAL_RX_A0 = A0;
  40. SoftwareSerial gpsSerial(gpsSerial_PIN_SERIAL_RX_A0, gpsSerial_PIN_SERIAL_TX_A1);
  41.  
  42. void setup(void)
  43. {
  44.   // Set the contact closure pin as output
  45.   pinMode(contactClosure_PIN_D2, OUTPUT);
  46.  
  47.   // Initialize the GPS serial communication
  48.   gpsSerial.begin(9600);
  49.  
  50.   // Initialize other setup code here
  51. }
  52.  
  53. void loop(void)
  54. {
  55.   // Read NMEA data from the GPS module
  56.   while (gpsSerial.available())
  57.   {
  58.     char c = gpsSerial.read();
  59.     // Process the NMEA data here
  60.     // Extract hours, minutes, and seconds from the NMEA data
  61.     // Display the values on the LED display
  62.  
  63.     // Declare and initialize minutes and seconds variables
  64.     int minutes = 0;
  65.     int seconds = 0;
  66.  
  67.     // Check if minutes and seconds are both 00
  68.     if (minutes == 0 && seconds == 0)
  69.     {
  70.       // Make a contact closure for about 1 second
  71.       digitalWrite(contactClosure_PIN_D2, HIGH);
  72.       delay(1000);
  73.       digitalWrite(contactClosure_PIN_D2, LOW);
  74.     }
  75.   }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement