Advertisement
pleasedontcode

GPS Display rev_03

May 12th, 2024
659
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 08:03:54
  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. oled is */
  23.     /* 128x64   #define SCREEN_WIDTH 128  #define */
  24.     /* SCREEN_HEIGHT 64  #define OLED_RESET -1  0x3C */
  25. /****** END SYSTEM REQUIREMENTS *****/
  26.  
  27. /****** DEFINITION OF LIBRARIES *****/
  28. #include <Wire.h>
  29. #include <Adafruit_SSD1306.h>   //https://github.com/stblassitude/Adafruit_SSD1306_Wemos_OLED.git
  30.  
  31. /****** FUNCTION PROTOTYPES *****/
  32. void setup(void);
  33. void loop(void);
  34.  
  35. /***** DEFINITION OF I2C PINS *****/
  36. const uint8_t GPS_SSD1306OledDisplay_I2C_PIN_SDA_D21 = 21;
  37. const uint8_t GPS_SSD1306OledDisplay_I2C_PIN_SCL_D22 = 22;
  38. const uint8_t GPS_SSD1306OledDisplay_I2C_SLAVE_ADDRESS = 0x3C; // 0x3C is the I2C address for the OLED display
  39.  
  40. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  41. Adafruit_SSD1306 display(GPS_SSD1306OledDisplay_I2C_PIN_SDA_D21, GPS_SSD1306OledDisplay_I2C_PIN_SCL_D22, GPS_SSD1306OledDisplay_I2C_SLAVE_ADDRESS);
  42.  
  43. void setup(void)
  44. {
  45.     // put your setup code here, to run once:
  46.     display.begin(SSD1306_SWITCHCAPVCC, GPS_SSD1306OledDisplay_I2C_SLAVE_ADDRESS); // Initialize the display with the I2C address
  47.  
  48.     // Display GPS coordinates and time
  49.     display.clearDisplay(); // Clear the display buffer
  50.     display.setTextSize(1); // Set text size
  51.     display.setTextColor(WHITE); // Set text color to white
  52.     display.setCursor(0, 0); // Set cursor position
  53.     display.println("North: 45.1234"); // Display North GPS coordinate
  54.     display.println("South: 35.6789"); // Display South GPS coordinate
  55.     display.println("East: 100.9876"); // Display East GPS coordinate
  56.     display.println("West: 90.5432"); // Display West GPS coordinate
  57.     display.println("Time: 12:34:56"); // Display current time
  58.     display.display(); // Update the display with the content
  59. }
  60.  
  61. void loop(void)
  62. {
  63.     // put your main code here, to run repeatedly:
  64.  
  65. }
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement