Advertisement
pleasedontcode

GPS Tracker rev_02

May 12th, 2024
487
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: GPS Tracker
  13.     - Source Code compiled for: ESP32 DevKit V1
  14.     - Source Code created on: 2024-05-12 08:00:44
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* I want the North South and East West GPS */
  21.     /* coordinates to appear on the display in addition */
  22.     /* to the time, the module is a lilygo TTGO. */
  23. /****** END SYSTEM REQUIREMENTS *****/
  24.  
  25.  
  26. /****** DEFINITION OF LIBRARIES *****/
  27. #include <Wire.h>
  28. #include <Adafruit_SSD1306.h>   //https://github.com/stblassitude/Adafruit_SSD1306_Wemos_OLED.git
  29.  
  30. /****** FUNCTION PROTOTYPES *****/
  31. void setup(void);
  32. void loop(void);
  33.  
  34. /***** DEFINITION OF I2C PINS *****/
  35. const uint8_t GPS_SSD1306OledDisplay_I2C_PIN_SDA_D21 = 21;
  36. const uint8_t GPS_SSD1306OledDisplay_I2C_PIN_SCL_D22 = 22;
  37. const uint8_t GPS_SSD1306OledDisplay_I2C_SLAVE_ADDRESS = 60;
  38.  
  39. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  40. Adafruit_SSD1306 display(/*DC*/ 4, /*RST*/ -1, /*CS*/ -1); // Assuming reset pin is not connected
  41.  
  42. void setup(void)
  43. {
  44.     // put your setup code here, to run once:
  45.     display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Initialize with I2C address 0x3C
  46.     display.display();
  47.     delay(2000);
  48.     display.clearDisplay();
  49.     display.drawPixel(10, 10, WHITE);
  50.     display.display();
  51.     delay(2000);
  52.     // Add your additional setup code here
  53.  
  54.     // Display GPS coordinates and time on the OLED
  55.     display.clearDisplay();
  56.     display.setTextSize(1);
  57.     display.setTextColor(WHITE);
  58.     display.setCursor(0, 0);
  59.     display.println("GPS Coordinates:");
  60.     display.setTextSize(2);
  61.     display.setCursor(0, 10);
  62.     display.println("N: 00.0000");
  63.     display.setCursor(0, 30);
  64.     display.println("E: 00.0000");
  65.     display.setTextSize(1);
  66.     display.setCursor(0, 50);
  67.     display.println("Time: 12:00 PM");
  68.     display.display();
  69.     delay(5000);
  70. }
  71.  
  72. void loop(void)
  73. {
  74.     // put your main code here, to run repeatedly:
  75. }
  76.  
  77. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement