Created
January 3, 2026 18:18
-
-
Save cjdell/54f44b0a7b94ed125811df120f5aab6c to your computer and use it in GitHub Desktop.
ESP32-C3 OLED ESPHome Tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| esphome: | |
| name: hello | |
| esp32: | |
| variant: esp32c3 | |
| framework: | |
| type: esp-idf | |
| logger: | |
| wifi: | |
| ssid: "Leighhack" | |
| password: "caffeine1234" | |
| api: | |
| i2c: | |
| sda: 5 | |
| scl: 6 | |
| # LED output | |
| output: | |
| - platform: gpio | |
| id: led_output | |
| pin: | |
| inverted: true | |
| number: GPIO8 | |
| # Light component for the LED | |
| light: | |
| - platform: binary | |
| name: "LED" | |
| output: led_output | |
| id: my_led | |
| # Binary sensor for button state - now visible in Home Assistant | |
| binary_sensor: | |
| - platform: gpio | |
| id: button_state | |
| name: "Button" | |
| pin: | |
| number: GPIO9 | |
| mode: INPUT_PULLUP | |
| inverted: true | |
| on_press: | |
| then: | |
| - logger.log: "Button state: PRESSED" | |
| - light.toggle: my_led # Toggle the LED | |
| - display.page.show_next: my_display | |
| - component.update: my_display | |
| - delay: 1000ms | |
| - display.page.show_next: my_display | |
| - component.update: my_display | |
| on_release: | |
| then: | |
| - logger.log: "Button state: RELEASED" | |
| # Display configuration with multiple pages | |
| display: | |
| - platform: ssd1306_i2c | |
| id: my_display | |
| model: "SSD1306 72x40" | |
| address: 0x3C | |
| pages: | |
| - id: display_page | |
| lambda: |- | |
| it.print(0, 0, id(font1), "Hello"); | |
| it.print(0, 20, id(font1), "World!"); | |
| - id: display_page2 | |
| lambda: |- | |
| it.print(0, 0, id(font1), "Button"); | |
| it.print(0, 20, id(font1), "Pressed!"); | |
| font: | |
| - file: "gfonts://Roboto" | |
| id: font1 | |
| size: 16 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment