Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ESP32 Essai de la touche test
- // Claude DUFOURMONT le 15/07/2020
- // claude.dufourmont@laposte.net
- // Touch T0 correspond à GPIO 4
- const int led = 2; // Il s'agit de la LED bleue de l'ESP32
- bool etatLed = 0;
- int val = 0;
- void setup()
- {
- Serial.begin(115200);
- pinMode(led, OUTPUT);
- digitalWrite(led, LOW);
- Serial.println("ESP32 Touch Test");
- }
- void loop()
- {
- val = touchRead(T0);
- for (int i = 0; i<10; i++)
- {
- val += touchRead(T0);
- delay(1);
- }
- val /=10;
- if (val < 90)
- {
- digitalWrite(led, HIGH);
- }
- else
- {
- digitalWrite(led, LOW);
- }
- Serial.println(touchRead(T0)); // Visualiser le moniteur série pour voir la valeur (ou le traceur série, la valeur baisse lorsque l'on touche GPIO4
- delay(50);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement