Initialize OLED (I2C) (oled_init_hw)¶
What it does: Initializes I2C, framebuffer and tries to detect the connected OLED controller (SSD1306/ST7567).

Inputs¶
SDA_PIN: value of type Value.SCL_PIN: value of type Value.- Field
HW_I2C: parameter selection in the block menu.
Output¶
- None (statement block).
When to use it¶
- Once at program start before using all blocks
fb_*andoded_refresh. - When changing I2C pins or reinitializing the display after an error.
Tips and pitfalls¶
- OLED detection looks for I2C addresses
60(0x3C) and63(0x3F); if nothing is found,displaywill remain unprepared. - Perform the initialization once on startup because it recreates the
buffer,fbufand I2C object each time it is called.
Usage example¶

Generated Python example¶
from machine import Pin, I2C
# inicializace OLED + framebufferu
i2c = I2C(0, scl=Pin(22), sda=Pin(21))