Skip to content

Commit fc1942b

Browse files
authored
doc: add simulation of ESP32-C6 with Wokwi (swiftlang#73)
Adds files necessary to run Wokwi simulations in VSCode. Users need to build the project, then can open diagram.json with the Wokwi plugin and press the Play button. This should will start the simulation.
1 parent 39f5078 commit fc1942b

File tree

6 files changed

+114
-0
lines changed

6 files changed

+114
-0
lines changed

esp32-led-blink-sdk/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,12 @@ $ idf.py flash
3737
```
3838

3939
- The LED should be blinking now.
40+
41+
### Simulating in VS Code
42+
43+
- Build the project, to generate binaries for simulation
44+
- Install [Wokwi for VS Code](https://docs.wokwi.com/vscode/getting-started/).
45+
- Open the `diagram.json` file.
46+
- Click the Play button to start simulation.
47+
- Click the Pause button to freeze simulation and display states of GPIOs.
48+

esp32-led-blink-sdk/diagram.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"version": 1,
3+
"author": "",
4+
"editor": "wokwi",
5+
"parts": [
6+
{
7+
"type": "board-esp32-c6-devkitc-1",
8+
"id": "esp",
9+
"top": 0,
10+
"left": 0,
11+
"attrs": { "builder": "esp-idf" }
12+
},
13+
{
14+
"type": "wokwi-resistor",
15+
"id": "r1",
16+
"top": 119.15,
17+
"left": -76.8,
18+
"attrs": { "value": "1000" }
19+
},
20+
{
21+
"type": "wokwi-led",
22+
"id": "led1",
23+
"top": 25.2,
24+
"left": -111.4,
25+
"attrs": { "color": "red" }
26+
}
27+
],
28+
"connections": [
29+
[ "esp:TX", "$serialMonitor:RX", "", [] ],
30+
[ "esp:RX", "$serialMonitor:TX", "", [] ],
31+
[ "r1:2", "esp:8", "red", [ "v0" ] ],
32+
[ "r1:1", "led1:A", "red", [ "h0" ] ],
33+
[ "led1:C", "esp:GND.1", "black", [ "v0" ] ]
34+
],
35+
"dependencies": {}
36+
}

esp32-led-blink-sdk/wokwi.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Wokwi Configuration File
2+
# Reference: https://docs.wokwi.com/vscode/project-config
3+
[wokwi]
4+
version = 1
5+
firmware = 'build/flasher_args.json'
6+
elf = 'build/main.elf'
7+
# gdbServerPort=3333
8+

esp32-led-strip-sdk/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,12 @@ $ idf.py flash
3636
```
3737

3838
- The LED strip should now be animating a sequence of random colors moving in one direction.
39+
40+
### Simulating in VS Code
41+
42+
- Build the project, to generate binaries for simulation
43+
- Install [Wokwi for VS Code](https://docs.wokwi.com/vscode/getting-started/).
44+
- Open the `diagram.json` file.
45+
- Click the Play button to start simulation.
46+
- Click the Pause button to freeze simulation and display states of GPIOs.
47+

esp32-led-strip-sdk/diagram.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"version": 1,
3+
"author": "",
4+
"editor": "wokwi",
5+
"parts": [
6+
{
7+
"type": "board-esp32-c6-devkitc-1",
8+
"id": "esp",
9+
"top": -13.91,
10+
"left": 90.52,
11+
"attrs": { "builder": "esp-idf" }
12+
},
13+
{ "type": "wokwi-neopixel", "id": "rgb1", "top": 73.3, "left": -20.2, "attrs": {} },
14+
{ "type": "wokwi-neopixel", "id": "rgb2", "top": 73.3, "left": 18.2, "attrs": {} },
15+
{ "type": "wokwi-neopixel", "id": "rgb3", "top": 73.3, "left": -250.6, "attrs": {} },
16+
{ "type": "wokwi-neopixel", "id": "rgb4", "top": 73.3, "left": -212.2, "attrs": {} },
17+
{ "type": "wokwi-neopixel", "id": "rgb5", "top": 73.3, "left": -58.6, "attrs": {} },
18+
{ "type": "wokwi-neopixel", "id": "rgb6", "top": 73.3, "left": -173.8, "attrs": {} },
19+
{ "type": "wokwi-neopixel", "id": "rgb7", "top": 73.3, "left": -97, "attrs": {} },
20+
{ "type": "wokwi-neopixel", "id": "rgb8", "top": 73.3, "left": -135.4, "attrs": {} }
21+
],
22+
"connections": [
23+
[ "esp:TX", "$serialMonitor:RX", "", [] ],
24+
[ "esp:RX", "$serialMonitor:TX", "", [] ],
25+
[ "rgb2:DIN", "esp:0", "green", [ "h28", "v-38.4" ] ],
26+
[ "rgb2:DOUT", "rgb1:DIN", "green", [ "h-9.6", "v-10.5" ] ],
27+
[ "rgb5:DOUT", "rgb7:DIN", "green", [ "h-9.6", "v-10.5" ] ],
28+
[ "rgb8:DOUT", "rgb6:DIN", "green", [ "h-9.6", "v-10.5" ] ],
29+
[ "rgb6:DOUT", "rgb4:DIN", "green", [ "v-0.9", "h-9.6", "v-9.6" ] ],
30+
[ "rgb4:DOUT", "rgb3:DIN", "green", [ "v-0.9", "h-9.6", "v-9.6" ] ],
31+
[ "rgb1:DOUT", "rgb5:DIN", "green", [ "h-9.6", "v-10.5" ] ],
32+
[ "rgb2:VSS", "esp:5V", "red", [ "h18.4", "v75.9" ] ],
33+
[ "rgb2:VDD", "rgb1:VSS", "red", [ "h-9.6", "v10.5" ] ],
34+
[ "rgb1:VDD", "rgb5:VSS", "red", [ "h-9.6", "v10.5" ] ],
35+
[ "rgb5:VDD", "rgb7:VSS", "red", [ "h-9.6", "v10.5" ] ],
36+
[ "rgb7:VDD", "rgb8:VSS", "red", [ "h-9.6", "v10.5" ] ],
37+
[ "rgb8:VDD", "rgb6:VSS", "red", [ "h-9.6", "v10.5" ] ],
38+
[ "rgb6:VDD", "rgb4:VSS", "red", [ "h-9.6", "v10.5" ] ],
39+
[ "rgb4:VDD", "rgb3:VSS", "red", [ "h-9.6", "v10.5" ] ],
40+
[ "rgb3:VDD", "esp:GND.1", "black", [ "h-9.6", "v96" ] ],
41+
[ "rgb8:DIN", "rgb7:DOUT", "green", [ "h8.8", "v9.6", "h9.6" ] ]
42+
],
43+
"dependencies": {}
44+
}

esp32-led-strip-sdk/wokwi.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Wokwi Configuration File
2+
# Reference: https://docs.wokwi.com/vscode/project-config
3+
[wokwi]
4+
version = 1
5+
firmware = 'build/flasher_args.json'
6+
elf = 'build/main.elf'
7+
# gdbServerPort=3333
8+

0 commit comments

Comments
 (0)