Advertisement
pleasedontcode

Scanner rev_48

Oct 29th, 2023
52
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 17:06:43
  15.     - Source Code generated by: AlexWind
  16.  
  17. ********* Pleasedontcode.com **********/
  18. /****** DEFINITION OF LIBRARIES *****/
  19. #include <Arduino.h>
  20. #include <SoftwareSerial.h>
  21. #include <Wire.h>
  22. #include <LiquidCrystal_I2C.h>
  23. #include <MicroNMEA.h>
  24.  
  25. /****** SYSTEM REQUIREMENT 1 *****/
  26. /* Reads NMEA 8-bit data from GPS module. Reads hours */
  27. /* minutes, seconds and Display h, m, s on LED */
  28. /* display. When mins and secs are 00 00, contact */
  29. /* closure for about 1 sec. */
  30.  
  31. /****** FUNCTION PROTOTYPES *****/
  32. void setup(void);
  33. void loop(void);
  34.  
  35. /***** DEFINITION OF DIGITAL INPUT PINS *****/
  36. const uint8_t enabler_PushButton_PIN_D3 = 3;
  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 led_LCD1602I2C_I2C_PIN_SDA_A4 = A4;
  48. const uint8_t led_LCD1602I2C_I2C_PIN_SCL_A5 = A5;
  49. const uint8_t led_LCD1602I2C_I2C_SLAVE_ADDRESS = 39;
  50.  
  51. void setup(void)
  52. {
  53.   // Initialize the digital pins
  54.   pinMode(enabler_PushButton_PIN_D3, INPUT_PULLUP);
  55.   pinMode(contactClosure_PIN_D2, OUTPUT);
  56.  
  57.   // Initialize the software serial for GPS module
  58.   gpsSerial.begin(9600);
  59.  
  60.   // Initialize other components and libraries as needed
  61. }
  62.  
  63. void loop(void)
  64. {
  65.   // Read NMEA data from GPS module
  66.   if (gpsSerial.available())
  67.   {
  68.     // Read the NMEA sentence
  69.     String nmeaSentence = gpsSerial.readStringUntil('\n');
  70.  
  71.     // Process the NMEA sentence and extract the time information
  72.     // Replace the following code with your own implementation
  73.     int hours = 0;
  74.     int minutes = 0;
  75.     int seconds = 0;
  76.  
  77.     // Display the time on the LED display
  78.     // Replace the following code with your own implementation
  79.  
  80.     // Check if the minutes and seconds are 00:00
  81.     if (minutes == 0 && seconds == 0)
  82.     {
  83.       // Make contact closure for about 1 second
  84.       digitalWrite(contactClosure_PIN_D2, HIGH);
  85.       delay(1000);
  86.       digitalWrite(contactClosure_PIN_D2, LOW);
  87.     }
  88.   }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement