fix(editor): default Blink circuit needs a series 220Ω resistor
The default canvas (Arduino Uno + LED on pin 13) wired the LED
directly between pin 13 and GND. Two consequences:
1. Real-world: that's a short across a forward-biased diode,
blowing the LED in seconds.
2. Simulator: ngspice can't find a steady-state branch current
for an unprotected diode (returns NaN / indeterminate), so
the LED visual never lights up. Only the wokwi-arduino-uno
element's BUILT-IN LED (rendered internally by the element,
not via wire+pinManager) was visible.
Fix: insert a 220Ω resistor between pin 13 and the LED anode,
cathode straight to GND. Same circuit every introductory Arduino
book teaches. SPICE converges, LED blinks visually on the canvas.
Reported by a user trying Blink on a fresh /editor visit.
This commit is contained in:
parent
9f4bf39f65
commit
8a6d72aa50
|
|
@ -1888,28 +1888,51 @@ export const useSimulatorStore = create<SimulatorState>((set, get) => {
|
|||
},
|
||||
|
||||
// ── Components ────────────────────────────────────────────────────────
|
||||
// Default canvas shown on a bare /editor visit: an external LED on
|
||||
// pin 13 PROTECTED BY A 220Ω SERIES RESISTOR (the canonical Blink
|
||||
// wiring textbooks teach). Without the resistor the LED is a direct
|
||||
// short forward-biased between 5V and GND — real hardware blows the
|
||||
// diode, and the ngspice solver returns an indeterminate / NaN branch
|
||||
// current so the visual LED never lights up on the canvas either.
|
||||
components: [
|
||||
{
|
||||
id: 'led-builtin',
|
||||
metadataId: 'led',
|
||||
x: 350,
|
||||
x: 380,
|
||||
y: 100,
|
||||
properties: { color: 'red' },
|
||||
},
|
||||
{
|
||||
id: 'r-builtin',
|
||||
metadataId: 'resistor',
|
||||
x: 240,
|
||||
y: 130,
|
||||
properties: { value: '220' },
|
||||
},
|
||||
],
|
||||
|
||||
wires: [
|
||||
// Pin 13 → resistor pin 1 (current-limiting side).
|
||||
{
|
||||
id: 'wire-builtin-pin13',
|
||||
start: { componentId: 'arduino-uno', pinName: '13', x: 0, y: 0 },
|
||||
end: { componentId: 'r-builtin', pinName: '1', x: 0, y: 0 },
|
||||
waypoints: [],
|
||||
color: '#22c55e',
|
||||
},
|
||||
// Resistor pin 2 → LED anode.
|
||||
{
|
||||
id: 'wire-builtin-anode',
|
||||
start: { componentId: 'arduino-uno', pinName: '13', x: 0, y: 0 },
|
||||
start: { componentId: 'r-builtin', pinName: '2', x: 0, y: 0 },
|
||||
end: { componentId: 'led-builtin', pinName: 'A', x: 0, y: 0 },
|
||||
waypoints: [],
|
||||
color: '#22c55e',
|
||||
},
|
||||
// LED cathode → GND.
|
||||
{
|
||||
id: 'wire-builtin-cathode',
|
||||
start: { componentId: 'arduino-uno', pinName: 'GND.1', x: 0, y: 0 },
|
||||
end: { componentId: 'led-builtin', pinName: 'C', x: 0, y: 0 },
|
||||
start: { componentId: 'led-builtin', pinName: 'C', x: 0, y: 0 },
|
||||
end: { componentId: 'arduino-uno', pinName: 'GND.1', x: 0, y: 0 },
|
||||
waypoints: [],
|
||||
color: '#000000',
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue