/********* Pleasedontcode.com **********
Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- Terms and Conditions:
You have a non-exclusive, revocable, worldwide, royalty-free license
for personal and commercial use. Attribution is optional; modifications
are allowed, but you're responsible for code maintenance. We're not
liable for any loss or damage. For full terms,
please visit pleasedontcode.com/termsandconditions.
- Project: GPS Display
- Source Code NOT compiled for: ESP32 DevKit V1
- Source Code created on: 2024-05-12 08:03:54
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* I want the North South and East West GPS */
/* coordinates to appear on the display in addition */
/* to the time, the module is a lilygo TTGO. oled is */
/* 128x64 #define SCREEN_WIDTH 128 #define */
/* SCREEN_HEIGHT 64 #define OLED_RESET -1 0x3C */
/****** END SYSTEM REQUIREMENTS *****/
/****** DEFINITION OF LIBRARIES *****/
#include
#include //https://github.com/stblassitude/Adafruit_SSD1306_Wemos_OLED.git
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
/***** DEFINITION OF I2C PINS *****/
const uint8_t GPS_SSD1306OledDisplay_I2C_PIN_SDA_D21 = 21;
const uint8_t GPS_SSD1306OledDisplay_I2C_PIN_SCL_D22 = 22;
const uint8_t GPS_SSD1306OledDisplay_I2C_SLAVE_ADDRESS = 0x3C; // 0x3C is the I2C address for the OLED display
/****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
Adafruit_SSD1306 display(GPS_SSD1306OledDisplay_I2C_PIN_SDA_D21, GPS_SSD1306OledDisplay_I2C_PIN_SCL_D22, GPS_SSD1306OledDisplay_I2C_SLAVE_ADDRESS);
void setup(void)
{
// put your setup code here, to run once:
display.begin(SSD1306_SWITCHCAPVCC, GPS_SSD1306OledDisplay_I2C_SLAVE_ADDRESS); // Initialize the display with the I2C address
// Display GPS coordinates and time
display.clearDisplay(); // Clear the display buffer
display.setTextSize(1); // Set text size
display.setTextColor(WHITE); // Set text color to white
display.setCursor(0, 0); // Set cursor position
display.println("North: 45.1234"); // Display North GPS coordinate
display.println("South: 35.6789"); // Display South GPS coordinate
display.println("East: 100.9876"); // Display East GPS coordinate
display.println("West: 90.5432"); // Display West GPS coordinate
display.println("Time: 12:34:56"); // Display current time
display.display(); // Update the display with the content
}
void loop(void)
{
// put your main code here, to run repeatedly:
}