From 5bd541e56fd94e075a2dcb33a5123614d131c0a2 Mon Sep 17 00:00:00 2001 From: David Montero Date: Sat, 23 May 2026 08:16:13 +0200 Subject: [PATCH] fix(examples): add OLED + buttons circuit to ESP32 smart-ui-eyes example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- frontend/src/data/examples-100-days.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/frontend/src/data/examples-100-days.ts b/frontend/src/data/examples-100-days.ts index 319c049a..2a9d2505 100644 --- a/frontend/src/data/examples-100-days.ts +++ b/frontend/src/data/examples-100-days.ts @@ -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"], }, {