fix(examples): add OLED + buttons circuit to ESP32 smart-ui-eyes example

The 100d-esp32-oled-smart-ui-eyes-animation-time-and-weather-micropython
example had components: [] and wires: [] — the MicroPython code wired
an SSD1306 OLED on I2C (GPIO 21/22) plus two buttons (GPIO 14, 27) but
the circuit had nothing on the canvas, so users saw a bare ESP32 board
and the simulation was missing every peripheral the code drives.

Adds:
- wokwi-ssd1306 on I2C (3V3 / GND / SDA=21 / SCL=22)
- two wokwi-pushbuttons wired HIGH-when-pressed (3V3 → 1.l, 2.l → GPIO
  14 / 27) to match the `if pin.value(): pressed` check in main.py
This commit is contained in:
David Montero 2026-05-23 08:16:13 +02:00
parent 7d9016396e
commit 5bd541e56f
1 changed files with 19 additions and 2 deletions

View File

@ -2281,8 +2281,25 @@ class SSD1306_SPI(SSD1306):
` },
],
code: '',
components: [],
wires: [],
components: [
{ type: 'wokwi-ssd1306', id: 'oled1', x: 420, y: 80, properties: {} },
{ type: 'wokwi-pushbutton', id: 'btn-next', x: 420, y: 280, properties: { color: 'blue' } },
{ type: 'wokwi-pushbutton', id: 'btn-sel', x: 560, y: 280, properties: { color: 'green' } },
],
wires: [
// OLED I2C — SDA = GPIO21, SCL = GPIO22 (matches SoftI2C in code)
{ id: 'w-oled-vcc', start: { componentId: 'esp32', pinName: '3V3' }, end: { componentId: 'oled1', pinName: 'VCC' }, color: '#ff4444' },
{ id: 'w-oled-gnd', start: { componentId: 'esp32', pinName: 'GND.1' }, end: { componentId: 'oled1', pinName: 'GND' }, color: '#000000' },
{ id: 'w-oled-sda', start: { componentId: 'esp32', pinName: '21' }, end: { componentId: 'oled1', pinName: 'SDA' }, color: '#22aaff' },
{ id: 'w-oled-scl', start: { componentId: 'esp32', pinName: '22' }, end: { componentId: 'oled1', pinName: 'SCL' }, color: '#ff8800' },
// Buttons — HIGH-when-pressed (one side to 3V3, other to GPIO). Code
// reads pin.value() == 1 on press, so they sit between 3.3V and the
// input pin. Add Pin.PULL_DOWN in MicroPython if the pin floats.
{ id: 'w-btn-next-3v3', start: { componentId: 'esp32', pinName: '3V3' }, end: { componentId: 'btn-next', pinName: '1.l' }, color: '#ff4444' },
{ id: 'w-btn-next-gpio', start: { componentId: 'btn-next', pinName: '2.l' }, end: { componentId: 'esp32', pinName: '14' }, color: '#aa66ff' },
{ id: 'w-btn-sel-3v3', start: { componentId: 'esp32', pinName: '3V3' }, end: { componentId: 'btn-sel', pinName: '1.l' }, color: '#ff4444' },
{ id: 'w-btn-sel-gpio', start: { componentId: 'btn-sel', pinName: '2.l' }, end: { componentId: 'esp32', pinName: '27' }, color: '#22cc22' },
],
tags: ["100-days", "esp32", "i2c_oled", "micropython", "wifi"],
},
{