Skip to content

Commit 74517a9

Browse files
committed
test(wokwi-dht22/dht22-uno): setting temperature / humidity through the scenario file
1 parent 5225805 commit 74517a9

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

.github/workflows/wokwi-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
test:
1111
runs-on: ubuntu-latest
1212
strategy:
13+
fail-fast: false
1314
matrix:
1415
test:
1516
- name: dht22-uno

wokwi-dht22/dht22-uno/dht22.test.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,21 @@ author: 'Uri Shaked'
55
steps:
66
- wait-serial: 'DHT22 test!'
77
# Wait for first reading
8-
- delay: 2000ms
8+
- delay: 500ms
99
# Check exact temperature and humidity values
1010
- wait-serial: 'Humidity: 45.80% Temperature: 23.50°C'
1111
# Wait for second reading to confirm consistency
12-
- delay: 2000ms
12+
- delay: 500ms
1313
- wait-serial: 'Humidity: 45.80% Temperature: 23.50°C'
14+
# Set new values
15+
- set-control:
16+
part-id: dht
17+
control: temperature
18+
value: 21.5
19+
- set-control:
20+
part-id: dht
21+
control: humidity
22+
value: 66.9
23+
- delay: 500ms
24+
# Check new values
25+
- wait-serial: 'Humidity: 66.90% Temperature: 21.50°C'

wokwi-dht22/dht22-uno/src/main.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,9 @@ void setup() {
1313
}
1414

1515
void loop() {
16-
// Wait a few seconds between measurements
17-
delay(2000);
16+
delay(500);
1817

19-
// Reading temperature or humidity takes about 250 milliseconds!
2018
float h = dht.readHumidity();
21-
// Read temperature as Celsius (the default)
2219
float t = dht.readTemperature();
2320

2421
// Check if any reads failed and exit early (to try again)

0 commit comments

Comments
 (0)