Advertisement
pleasedontcode

OLED Display rev_01

May 2nd, 2024
794
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: OLED Display
  13.     - Source Code NOT compiled for: ESP32 DevKit V1
  14.     - Source Code created on: 2024-05-03 03:51:55
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* Writing Helo */
  21. /****** END SYSTEM REQUIREMENTS *****/
  22.  
  23. /****** DEFINITION OF LIBRARIES *****/
  24. #include <Wire.h>
  25. #include <Adafruit_SSD1306.h>    // Include Adafruit SSD1306 Library
  26. #include <Adafruit_GFX.h>        // Include Adafruit GFX Library for graphics
  27.  
  28. /****** FUNCTION PROTOTYPES *****/
  29. void setup(void);
  30. void loop(void);
  31.  
  32. /***** DEFINITION OF I2C PINS *****/
  33. const uint8_t Vg_SSD1306OledDisplay_I2C_PIN_SDA_D21      = 21;
  34. const uint8_t Vg_SSD1306OledDisplay_I2C_PIN_SCL_D22      = 22;
  35. const uint8_t Vg_SSD1306OledDisplay_I2C_SLAVE_ADDRESS    = 60;
  36.  
  37. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  38. Adafruit_SSD1306 display(Vg_SSD1306OledDisplay_I2C_PIN_SDA_D21, Vg_SSD1306OledDisplay_I2C_PIN_SCL_D22);  // Initialize the Adafruit_SSD1306 object with I2C pins
  39.  
  40. void setup(void)
  41. {
  42.     display.begin(SSD1306_SWITCHCAPVCC, Vg_SSD1306OledDisplay_I2C_SLAVE_ADDRESS);  // Initialize the OLED display
  43.     display.display();  // Update the display
  44.     delay(2000);
  45.  
  46.     display.clearDisplay();
  47.     display.setTextSize(1);  // Set text size
  48.     display.setTextColor(WHITE);  // Set text color
  49.     display.setCursor(0, 20);  // Set cursor position
  50.     display.println("Helo");  // Print "Helo" on the display
  51.     display.display();  // Update the display
  52.     delay(2000);
  53. }
  54.  
  55. void loop(void)
  56. {
  57.     // Main code - runs repeatedly
  58. }
  59.  
  60. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement