Skip to content

Commit 7486694

Browse files
committed
feat(wokwi-slide-potentiometer/pot-esp32): add test
1 parent 3254275 commit 7486694

File tree

6 files changed

+76
-0
lines changed

6 files changed

+76
-0
lines changed

.github/workflows/wokwi-test.yml

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ jobs:
3333
- name: slide-potentiometer-uno
3434
path: wokwi-slide-potentiometer/pot-uno
3535
scenario: slide-potentiometer.test.yaml
36+
- name: slide-potentiometer-esp32
37+
path: wokwi-slide-potentiometer/pot-esp32
38+
scenario: slide-potentiometer.test.yaml
3639
steps:
3740
- uses: actions/checkout@v4
3841

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"version": 1,
3+
"author": "Wokwi",
4+
"editor": "wokwi",
5+
"parts": [
6+
{ "type": "board-esp32-devkit-c-v4", "id": "esp32", "top": 0, "left": 0, "attrs": {} },
7+
{
8+
"type": "wokwi-slide-potentiometer",
9+
"id": "pot1",
10+
"top": 81.8,
11+
"left": 152.6,
12+
"attrs": { "position": "0.5", "travelLength": "30" }
13+
}
14+
],
15+
"connections": [
16+
[ "esp32:TX", "$serialMonitor:RX", "", [] ],
17+
[ "esp32:RX", "$serialMonitor:TX", "", [] ],
18+
[ "esp32:GPIO36", "pot1:SIG", "green", [ "v0", "h0" ] ],
19+
[ "esp32:GND.1", "pot1:GND", "black", [ "h-23.81", "v76.8", "h378.8" ] ],
20+
[ "esp32:3V3", "pot1:VCC", "red", [ "v-57.6", "h148.99" ] ],
21+
[ "esp32:35", "pot1:SIG", "green", [ "h-14.21", "v144", "h153.6" ] ]
22+
],
23+
"dependencies": {}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[env:esp32]
2+
platform = espressif32
3+
board = esp32dev
4+
framework = arduino
5+
build_flags = -D ARDUINO_ARCH_ESP32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: 'ESP32 Slide Potentiometer Test'
2+
version: 1
3+
author: 'Test Author'
4+
5+
steps:
6+
- delay: 100ms
7+
- wait-serial: 'Potentiometer value: 2048'
8+
- set-control:
9+
part-id: pot1
10+
control: position
11+
value: 1
12+
- delay: 100ms
13+
- wait-serial: 'Potentiometer value: 4095'
14+
- set-control:
15+
part-id: pot1
16+
control: position
17+
value: 0
18+
- delay: 100ms
19+
- wait-serial: 'Potentiometer value: 0'
20+
- set-control:
21+
part-id: pot1
22+
control: position
23+
value: 0.5
24+
- delay: 100ms
25+
- wait-serial: 'Potentiometer value: 2048'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include <Arduino.h>
2+
3+
const int POT_PIN = 35; // Slide potentiometer connected to GPIO35
4+
5+
void setup() {
6+
Serial.begin(115200);
7+
pinMode(POT_PIN, INPUT);
8+
}
9+
10+
void loop() {
11+
int potValue = analogRead(POT_PIN);
12+
Serial.print("Potentiometer value: ");
13+
Serial.println(potValue);
14+
delay(100); // Small delay to prevent flooding the serial output
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[wokwi]
2+
version = 1
3+
firmware = '.pio/build/esp32/firmware.bin'
4+
elf = '.pio/build/esp32/firmware.elf'

0 commit comments

Comments
 (0)