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: SSD1306 Display
- - Source Code compiled for: ESP32 DevKit V1
- - Source Code created on: 2024-04-01 10:46:18
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* statemachine */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Wire.h>
- #include <Adafruit_SSD1306.h>
- /*
- * /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /*
- * /*!< Definitions of I2C pins */
- const uint8_t DISPLAY_PIN_SDA = 21; // connected to SDA pin on the ESP32
- const uint8_t DISPLAY_PIN_SCL = 22; // connected to SCL pin on the ESP32
- const uint8_t DISPLAY_SLAVE_ADDRESS = 0x3C; // I2C address of the display
- Adafruit_SSD1306 display(DISPLAY_PIN_SDA, DISPLAY_PIN_SCL);
- /*
- * Initialize the I2C communication with the display and perform setup tasks
- */
- void setup(void)
- {
- Wire.begin(DISPLAY_PIN_SDA, DISPLAY_PIN_SCL);
- display.begin(SSD1306_SWITCHCAPVCC, DISPLAY_SLAVE_ADDRESS);
- display.clearDisplay();
- display.dim(0);
- display.setTextColor(SSD1306_WHITE);
- display.setRotation(1);
- /* INSERT LCD CONFIGURATION */
- display.println("Setup Process...");
- display.display();
- delay(2000);
- display.clearDisplay();
- }
- /*
- * Main loop of the program
- */
- void loop(void)
- {
- display.setCursor(0, 0);
- display.clearDisplay();
- display.display();
- display.println("Loop!");
- display.display();
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement