arduino-esp32/tests/validation/gpio/gpio.ino
Lucas Saavedra Vaz 789b1a8425
ci(wokwi): Add Wokwi emulator to workflow (#9540)
* ci(wokwi): Add wokwi emulator to CI

* feat(wokwi): Support scenario

* feat(wokwi): Add simple CI test for push button

* sudo apt command

* sudo both apt commands

* Add missing test.py file

* Test pytest path changes

* empty push

* move wokwi cli token variable

* move token back to wokwi job

* Update hil.yml

* Update hil.yml

* revert run on pr

* run on PR target

* run only on master

* ci(wokwi): Support wokwi

* ci(wokwi): Skip unsupported and performance test

* ci(wokwi): run wokwi tests without label

* debug: run build on windows

* RUN WIFI WITH PSRAM ON-OFF

* fix psram for S3

* Revert "debug: run build on windows"

This reverts commit bc085e50502eb470836276097fa45ee0e2374ed1.

* ci(wokwi): Run workflow only if build was sucessful

* ci(pre-commit): Apply automatic fixes

* ci(wokwi): Add generated files to gitignore

---------

Co-authored-by: Jan Prochazka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2024-05-07 18:46:19 +03:00

31 lines
563 B
C++

#include <Arduino.h>
#include <unity.h>
#define BTN 0
void test_button() {
Serial.println("Button test");
static int count = 0;
static int lastState = HIGH;
while (count < 3) {
int state = digitalRead(BTN);
if (state != lastState) {
if (state == LOW) {
count++;
Serial.print("Button pressed ");
Serial.print(count);
Serial.println(" times");
}
lastState = state;
}
delay(10);
}
}
void setup() {
Serial.begin(115200);
pinMode(BTN, INPUT_PULLUP);
test_button();
}
void loop() {}