OLED Screen (SSD1306)
What you'll build¶
Give your micro:bit a bigger screen: write lines of text on an SSD1306 OLED.
Wiring¶
| Part | Part pin | micro:bit pin |
|---|---|---|
| SSD1306 OLED | SCL | P19 |
| SSD1306 OLED | SDA | P20 |
| SSD1306 OLED | VCC | 3V |
| SSD1306 OLED | GND | GND |
The OLED uses the micro:bit's default I²C pins, reachable through an edge connector breakout board.
Code¶
Check where text lands: empty and off-screen text draw nothing, and long text stops at the edge of the screen.
How it works¶
initialize()sends the start-up commands to the OLED at I²C address0x3C;clear_oled()blanks it.add_text(x, y, text)writes text at columnx, rowy(rows are 8 pixels tall).
Try this next¶
- Show live sensor readings, like temperature or distance.
- Display the last message received over radio.
- Build a scoreboard updated with buttons A and B.