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: "OLED Integration"
- - Source Code compiled for: ESP32 DevKit V1
- - Source Code created on: 2024-02-17 06:55:05
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* Wyswietl encje pobrana z Asystent domowy. HA */
- /* ip:192.168.1.200 ssid: Coolmatic_Home hasło: */
- /* Słodziak770811m encja: czujnik.total_power_dom_3 */
- /* Dodaj na wyswietlacz godzine pobierana z HA */
- /****** SYSTEM REQUIREMENT 2 *****/
- /* Wyswietl encje pobrana z Asystent domowy. HA */
- /* ip:192.168.1.200 ssid: Coolmatic_Home hasło: */
- /* Słodziak770811m encja: czujnik.total_power_dom_3 */
- /* Dodaj na wyswietlacz godzine pobierana z HA */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Wire.h>
- #include <Adafruit_GFX.h>
- #include <Adafruit_SSD1306.h>
- #include <U8g2_for_Adafruit_GFX.h>
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF I2C PINS *****/
- const uint8_t display_SSD1306OledDisplay_I2C_PIN_SDA = 21;
- const uint8_t display_SSD1306OledDisplay_I2C_PIN_SCL = 22;
- const uint8_t display_SSD1306OledDisplay_I2C_SLAVE_ADDRESS = 60;
- /****** DEFINITION OF LIBRARY CLASS INSTANCES *****/
- Adafruit_SSD1306 display(display_SSD1306OledDisplay_I2C_PIN_SDA, display_SSD1306OledDisplay_I2C_PIN_SCL);
- U8G2_FOR_ADAFRUIT_GFX u8g2_for_adafruit_gfx;
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- String homeAssistantIpAddress = "192.168.1.200";
- String homeAssistantSsid = "Coolmatic_Home";
- String homeAssistantPassword = "Słodziak770811m";
- String homeAssistantEntity = "czujnik.total_power_dom_3";
- void setup(void) {
- // put your setup code here, to run once:
- // Initialize SSD1306 display
- display.begin(SSD1306_SWITCHCAPVCC, display_SSD1306OledDisplay_I2C_SLAVE_ADDRESS);
- display.display();
- delay(2000);
- display.clearDisplay();
- display.drawPixel(10, 10, WHITE);
- display.display();
- delay(2000);
- display.clearDisplay();
- // Initialize U8g2_for_Adafruit_GFX library
- u8g2_for_adafruit_gfx.begin(display);
- // Other setup code...
- }
- void loop(void) {
- // put your main code here, to run repeatedly:
- display.clearDisplay();
- // Print Home Assistant entity value on the display
- display.setTextSize(2);
- display.setTextColor(WHITE);
- display.setCursor(0, 0);
- display.println(homeAssistantEntity);
- // Print Home Assistant time on the display
- display.setTextSize(1);
- display.setTextColor(WHITE);
- display.setCursor(0, 20);
- // Replace the following code with your logic to retrieve the time value from Home Assistant
- String homeAssistantTime = "12:34:56"; // Example time value, replace it with the actual implementation
- display.println(homeAssistantTime);
- display.display();
- delay(2000);
- }
- /****** END SYSTEM REQUIREMENTS *****/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement