From 2dea3f04486ee109b68da55dc0bf79fed16b5612 Mon Sep 17 00:00:00 2001 From: David Montero Date: Sat, 23 May 2026 08:23:15 +0200 Subject: [PATCH] fix(examples): correct SSD1306 + big-sound-sensor pin names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit robot-desktop-eyes and the day-30/100-days OLED example wired the SSD1306 OLED with SDA/SCL/VCC, but the wokwi-ssd1306 element exposes pinInfo as DATA/CLK/VIN/GND. The mismatched names couldn't resolve, so all three wire endpoints fell back to (0,0) of the component and visually attached to the corner instead of the pins. Same class of bug on the wokwi-big-sound-sensor in robot-desktop-eyes: the element has AOUT/DOUT (no plain OUT). The sketch uses digitalRead(SOUND_PIN), so route to DOUT. The COMPONENT_PIN_ALIASES map in wokwiZip.ts only normalises on .zip import — static examples have to use the real pinInfo names. --- frontend/src/data/examples-100-days.ts | 6 +++--- frontend/src/data/examples-robot-desktop.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/src/data/examples-100-days.ts b/frontend/src/data/examples-100-days.ts index 2a9d2505..7fdc5384 100644 --- a/frontend/src/data/examples-100-days.ts +++ b/frontend/src/data/examples-100-days.ts @@ -2288,10 +2288,10 @@ class SSD1306_SPI(SSD1306): ], 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-vcc', start: { componentId: 'esp32', pinName: '3V3' }, end: { componentId: 'oled1', pinName: 'VIN' }, 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' }, + { id: 'w-oled-sda', start: { componentId: 'esp32', pinName: '21' }, end: { componentId: 'oled1', pinName: 'DATA' }, color: '#22aaff' }, + { id: 'w-oled-scl', start: { componentId: 'esp32', pinName: '22' }, end: { componentId: 'oled1', pinName: 'CLK' }, 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. diff --git a/frontend/src/data/examples-robot-desktop.ts b/frontend/src/data/examples-robot-desktop.ts index b23b1002..51da8814 100644 --- a/frontend/src/data/examples-robot-desktop.ts +++ b/frontend/src/data/examples-robot-desktop.ts @@ -122,7 +122,7 @@ export const robotDesktopExamples: ExampleProject[] = [ // off the ESP32. The two servos run off 3V3 too because the // simulator doesn't model the brown-out a real SG90 would // cause — on real hardware they'd need an external 5V. - w('p-oled-vcc', ['esp32', '3V3'], ['oled', 'VCC'], '#ff0000'), + w('p-oled-vcc', ['esp32', '3V3'], ['oled', 'VIN'], '#ff0000'), w('p-oled-gnd', ['oled', 'GND'], ['esp32', 'GND'], '#000000'), w('p-dht-vcc', ['esp32', '3V3'], ['dht', 'VCC'], '#ff0000'), w('p-dht-gnd', ['dht', 'GND'], ['esp32', 'GND'], '#000000'), @@ -140,13 +140,13 @@ export const robotDesktopExamples: ExampleProject[] = [ // ── I²C bus: OLED on the ESP32's default I²C (SDA=21, SCL=22). // U8G2_SSD1306_128X64_NONAME_F_HW_I2C in the sketch uses // Wire.begin() which defaults to these pins. - w('i2c-sda', ['esp32', '21'], ['oled', 'SDA'], '#ffd000'), - w('i2c-scl', ['esp32', '22'], ['oled', 'SCL'], '#00d0ff'), + w('i2c-sda', ['esp32', '21'], ['oled', 'DATA'], '#ffd000'), + w('i2c-scl', ['esp32', '22'], ['oled', 'CLK'], '#00d0ff'), // ── Sensor signal lines, matching Common.h's #define block. w('s-dht', ['dht', 'SDA'], ['esp32', '15'], '#00ffaa'), w('s-pir', ['pir', 'OUT'], ['esp32', '4'], '#ff00ff'), - w('s-snd', ['sound', 'OUT'], ['esp32', '2'], '#ffaa00'), + w('s-snd', ['sound', 'DOUT'], ['esp32', '2'], '#ffaa00'), w('s-ldr', ['ldr', 'AO'], ['esp32', '34'], '#aaff00'), // ── Servo signal lines (PWM via LEDC on the ESP32).