Advertisement
pleasedontcode

"OLED Setup" rev_02

Feb 17th, 2024
73
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 Setup"
  13.     - Source Code compiled for: ESP32 DevKit V1
  14.     - Source Code created on: 2024-02-17 06:44:15
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* wyswietl na wyswietlaczy encje pobrane z home */
  21.     /* assistant */
  22. /****** SYSTEM REQUIREMENT 2 *****/
  23.     /* Wyswietl encje pobrane z home assistant.  ip Home */
  24.     /* assistant to 192.168.1.200  ssid: Coolmatic_Home */
  25.     /* password: Slodziak770811m */
  26. /****** END SYSTEM REQUIREMENTS *****/
  27.  
  28. /****** DEFINITION OF LIBRARIES *****/
  29. #include <Wire.h>
  30. #include <Adafruit_SSD1306.h>
  31. #include <U8g2_for_Adafruit_GFX.h>
  32.  
  33. /****** FUNCTION PROTOTYPES *****/
  34. void setup(void);
  35. void loop(void);
  36.  
  37. /****** DEFINITION OF I2C PINS AND SLAVE ADDRESS *****/
  38. const uint8_t SSD1306_I2C_SDA_PIN = 21;
  39. const uint8_t SSD1306_I2C_SCL_PIN = 22;
  40. const uint8_t SSD1306_I2C_SLAVE_ADDRESS = 60;
  41.  
  42. /****** DEFINITION OF LIBRARY CLASS INSTANCES *****/
  43. Adafruit_SSD1306 display(SSD1306_I2C_SDA_PIN, SSD1306_I2C_SCL_PIN, SSD1306_I2C_SLAVE_ADDRESS);
  44. U8G2_FOR_ADAFRUIT_GFX u8g2_for_adafruit_gfx;
  45.  
  46. /****** SYSTEM REQUIREMENTS *****/
  47. /****** SYSTEM REQUIREMENT 1 *****/
  48. // Display entities received from Home Assistant
  49. void displayEntitiesFromHomeAssistant() {
  50.   // Code to fetch and display entities from Home Assistant
  51. }
  52.  
  53. /****** SYSTEM REQUIREMENT 2 *****/
  54. // Display entities fetched from Home Assistant with IP: 192.168.1.200, SSID: Coolmatic_Home, Password: Slodziak770811m
  55. void displayEntitiesFromHomeAssistantWithIP() {
  56.   // Code to fetch and display entities from Home Assistant with the specified IP
  57. }
  58.  
  59. void setup(void)
  60. {
  61.   // Initialize display with I2C pins and slave address
  62.   display.begin(SSD1306_SWITCHCAPVCC, SSD1306_I2C_SLAVE_ADDRESS);
  63.  
  64.   // Initialize U8g2_for_Adafruit_GFX
  65.   u8g2_for_adafruit_gfx.begin(display);
  66.  
  67.   // Other setup code here
  68. }
  69.  
  70. void loop(void)
  71. {
  72.   // Main code here
  73.  
  74.   // Display update code
  75.   display.display();
  76. }
  77.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement