Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* 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: **Display Hello**
- - Source Code NOT compiled for: ESP32 DevKit V1
- - Source Code created on: 2025-02-15 17:50:22
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* Display "Hello, World!" on the SSD1306 OLED using */
- /* I2C communication with SDA on pin D21 and SCL on */
- /* pin D22, ensuring proper initialization of the */
- /* Adafruit SSD1306 library. */
- /****** END SYSTEM REQUIREMENTS *****/
- /* START CODE */
- /****** DEFINITION OF LIBRARIES *****/
- #include <Wire.h>
- #include <Adafruit_SSD1306.h> //https://github.com/stblassitude/Adafruit_SSD1306_Wemos_OLED.git
- #include <U8g2_for_Adafruit_GFX.h> //https://github.com/olikraus/U8g2_for_Adafruit_GFX
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF I2C PINS *****/
- const uint8_t display_SSD1306OledDisplay_I2C_PIN_SDA_D21 = 21;
- const uint8_t display_SSD1306OledDisplay_I2C_PIN_SCL_D22 = 22;
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
- // Create an instance of the Adafruit_SSD1306 class
- Adafruit_SSD1306 display(128, 32, &Wire); // Initialize with width, height, and Wire instance
- void setup(void)
- {
- // Initialize the display
- if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Check if the display is connected
- for(;;); // Don't proceed, loop forever
- }
- display.clearDisplay(); // Clear the buffer
- display.setTextSize(1); // Set text size
- display.setTextColor(SSD1306_WHITE); // Set text color
- display.setCursor(0, 0); // Set cursor position
- display.print("Hello, World!"); // Print text
- display.display(); // Display the buffer on the screen
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement