You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
/**
|
|
|
|
* ESP32 Soundboard
|
|
|
|
*
|
|
|
|
* Hendriks Projekt
|
|
|
|
*
|
|
|
|
* https://dev.xd0.de/hendrik/soundboard
|
|
|
|
*/
|
|
|
|
#include "Arduino.h"
|
|
|
|
|
|
|
|
#include "keyboard.h"
|
|
|
|
|
|
|
|
#define LED_PIN 21
|
|
|
|
|
|
|
|
Keyboard keyboard;
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
// initialize LED digital pin as an output.
|
|
|
|
pinMode(LED_PIN, OUTPUT);
|
|
|
|
keyboard.init();
|
|
|
|
}
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
bool touched = false;
|
|
|
|
for(int i; i<=9; i++) {
|
|
|
|
if (keyboard.getTouchDetected(i) == true) {
|
|
|
|
touched = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (touched == true) {
|
|
|
|
// turn the LED on (HIGH is the voltage level)
|
|
|
|
digitalWrite(LED_PIN, HIGH);
|
|
|
|
} else {
|
|
|
|
// turn the LED off by making the voltage LOW
|
|
|
|
digitalWrite(LED_PIN, LOW);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// wait for a second
|
|
|
|
delay(50);
|
|
|
|
}
|