From 7acce0b610a385ea73a2a6232ca1eaa1c21bce31 Mon Sep 17 00:00:00 2001 From: a2nr Date: Thu, 16 Apr 2026 08:00:54 +0700 Subject: [PATCH] refactor: update component wiring and properties in Arduino examples --- examples/content/button_input_arduino.md | 96 ++++++++++--- examples/content/traffic_light_arduino.md | 159 ++++++++++++++++++---- frontend/src/lib/components/Navbar.svelte | 2 +- frontend/src/lib/stores/auth.ts | 66 +++++++-- velxio | 2 +- 5 files changed, 267 insertions(+), 58 deletions(-) diff --git a/examples/content/button_input_arduino.md b/examples/content/button_input_arduino.md index b5392c4..ce7a9d0 100644 --- a/examples/content/button_input_arduino.md +++ b/examples/content/button_input_arduino.md @@ -148,22 +148,40 @@ void loop() { "board": "arduino:avr:uno", "components": [ { - "type": "wokwi-pushbutton", - "id": "button-1", - "x": 400, - "y": -100, - "rotation": 0, - "props": {} - }, - { - "type": "wokwi-led", - "id": "led-1", - "x": 400, - "y": -250, + "type": "led", + "id": "led-builtin", + "x": 956.2066448009604, + "y": -15.285273464964305, "rotation": 0, "props": { - "color": "green", - "pin": 13 + "color": "red", + "pin": 13, + "state": false, + "value": false + } + }, + { + "type": "resistor", + "id": "resistor-1776299815587-z0q0jzny8", + "x": 808.6031046903261, + "y": 44.96592399354325, + "rotation": 0, + "props": { + "value": false, + "state": false + } + }, + { + "type": "pushbutton", + "id": "pushbutton-1776299852057-07xh6qh7g", + "x": 829.2414304859469, + "y": 230.19576790585754, + "rotation": 0, + "props": { + "color": "red", + "pressed": false, + "label": "", + "xray": false } } ], @@ -179,20 +197,54 @@ PRESSED { "wires": [ { - "start": { "componentId": "arduino-uno", "pinName": "2" }, - "end": { "componentId": "button-1", "pinName": "1.l" } + "start": { + "componentId": "resistor-1776299815587-z0q0jzny8", + "pinName": "2" + }, + "end": { + "componentId": "led-builtin", + "pinName": "A" + } }, { - "start": { "componentId": "button-1", "pinName": "2.l" }, - "end": { "componentId": "arduino-uno", "pinName": "GND" } + "start": { + "componentId": "arduino-uno", + "pinName": "GND.1" + }, + "end": { + "componentId": "led-builtin", + "pinName": "C" + } }, { - "start": { "componentId": "arduino-uno", "pinName": "13" }, - "end": { "componentId": "led-1", "pinName": "A" } + "start": { + "componentId": "resistor-1776299815587-z0q0jzny8", + "pinName": "1" + }, + "end": { + "componentId": "arduino-uno", + "pinName": "13" + } }, { - "start": { "componentId": "led-1", "pinName": "C" }, - "end": { "componentId": "arduino-uno", "pinName": "GND" } + "start": { + "componentId": "pushbutton-1776299852057-07xh6qh7g", + "pinName": "1.l" + }, + "end": { + "componentId": "arduino-uno", + "pinName": "2" + } + }, + { + "start": { + "componentId": "arduino-uno", + "pinName": "GND.3" + }, + "end": { + "componentId": "pushbutton-1776299852057-07xh6qh7g", + "pinName": "2.l" + } } ] } diff --git a/examples/content/traffic_light_arduino.md b/examples/content/traffic_light_arduino.md index f48562e..05bbe62 100644 --- a/examples/content/traffic_light_arduino.md +++ b/examples/content/traffic_light_arduino.md @@ -147,40 +147,81 @@ void loop() { "board": "arduino:avr:uno", "components": [ { - "type": "wokwi-led", + "type": "led", "id": "led-red", - "x": 370, - "y": -300, + "x": 409.6091884525257, + "y": 65.40692157090741, "rotation": 0, "props": { "color": "red", - "pin": 13 + "pin": 13, + "state": true, + "value": true } }, { - "type": "wokwi-led", + "type": "led", "id": "led-yellow", - "x": 370, - "y": -200, + "x": 466.09101803924966, + "y": 66.43228050989252, "rotation": 0, "props": { "color": "yellow", - "pin": 12 + "pin": 12, + "state": false, + "value": false } }, { - "type": "wokwi-led", + "type": "led", "id": "led-green", - "x": 370, - "y": -100, + "x": 522.0366933470766, + "y": 63.613964067867315, "rotation": 0, "props": { "color": "green", - "pin": 11 + "pin": 11, + "state": false, + "value": false + } + }, + { + "type": "resistor", + "id": "resistor-1776300566703-7pi4wei9j", + "x": 275.08055011716567, + "y": 133.79325981817132, + "rotation": 0, + "props": { + "value": true, + "state": true + } + }, + { + "type": "resistor", + "id": "resistor-1776300590088-k4l87u1rf", + "x": 273.3198126609919, + "y": 178.95644554504224, + "rotation": 0, + "props": { + "value": false, + "state": false + } + }, + { + "type": "resistor", + "id": "resistor-1776300593575-rklkixiwy", + "x": 270.5981563595655, + "y": 220.2759558909028, + "rotation": 0, + "props": { + "value": false, + "state": false } } ], - "wires": [] + "wires": [ + + ] } ---END_VELXIO_CIRCUIT--- @@ -194,29 +235,95 @@ YELLOW ---EXPECTED_WIRING--- { "wires": [ - { - "start": { "componentId": "arduino-uno", "pinName": "13" }, - "end": { "componentId": "led-red", "pinName": "A" } + { + "start": { + "componentId": "resistor-1776300566703-7pi4wei9j", + "pinName": "2" + }, + "end": { + "componentId": "led-red", + "pinName": "A" + } }, { - "start": { "componentId": "led-red", "pinName": "C" }, - "end": { "componentId": "arduino-uno", "pinName": "GND" } + "start": { + "componentId": "resistor-1776300590088-k4l87u1rf", + "pinName": "2" + }, + "end": { + "componentId": "led-yellow", + "pinName": "A" + } }, { - "start": { "componentId": "arduino-uno", "pinName": "12" }, - "end": { "componentId": "led-yellow", "pinName": "A" } + "start": { + "componentId": "resistor-1776300593575-rklkixiwy", + "pinName": "2" + }, + "end": { + "componentId": "led-green", + "pinName": "A" + } }, { - "start": { "componentId": "led-yellow", "pinName": "C" }, - "end": { "componentId": "arduino-uno", "pinName": "GND" } + "start": { + "componentId": "arduino-uno", + "pinName": "GND.3" + }, + "end": { + "componentId": "led-red", + "pinName": "C" + } }, { - "start": { "componentId": "arduino-uno", "pinName": "11" }, - "end": { "componentId": "led-green", "pinName": "A" } + "start": { + "componentId": "arduino-uno", + "pinName": "GND.3" + }, + "end": { + "componentId": "led-yellow", + "pinName": "C" + } }, { - "start": { "componentId": "led-green", "pinName": "C" }, - "end": { "componentId": "arduino-uno", "pinName": "GND" } + "start": { + "componentId": "arduino-uno", + "pinName": "GND.3" + }, + "end": { + "componentId": "led-green", + "pinName": "C" + } + }, + { + "start": { + "componentId": "resistor-1776300566703-7pi4wei9j", + "pinName": "1" + }, + "end": { + "componentId": "arduino-uno", + "pinName": "13" + } + }, + { + "start": { + "componentId": "resistor-1776300590088-k4l87u1rf", + "pinName": "1" + }, + "end": { + "componentId": "arduino-uno", + "pinName": "12" + } + }, + { + "start": { + "componentId": "resistor-1776300593575-rklkixiwy", + "pinName": "1" + }, + "end": { + "componentId": "arduino-uno", + "pinName": "11" + } } ] } diff --git a/frontend/src/lib/components/Navbar.svelte b/frontend/src/lib/components/Navbar.svelte index fd59201..725e73a 100644 --- a/frontend/src/lib/components/Navbar.svelte +++ b/frontend/src/lib/components/Navbar.svelte @@ -31,7 +31,7 @@ } -