Advertisement
pleasedontcode

GPS Display rev_01

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