|
|
|
/**
|
|
|
|
* ESP32 Soundboard
|
|
|
|
*
|
|
|
|
* Hendriks Projekt
|
|
|
|
*
|
|
|
|
* https://dev.xd0.de/hendrik/soundboard
|
|
|
|
*/
|
|
|
|
#include "Arduino.h"
|
|
|
|
|
|
|
|
#include "keyboard.h"
|
|
|
|
|
|
|
|
#define VERSION "0.0"
|
|
|
|
#define LED_PIN 21
|
|
|
|
|
|
|
|
Keyboard keyboard;
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
// initialize LED digital pin as an output.
|
|
|
|
pinMode(LED_PIN, OUTPUT);
|
|
|
|
keyboard.init();
|
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.println("-------------------------------------");
|
|
|
|
Serial.print("Soundboard v.");
|
|
|
|
Serial.println(VERSION);
|
|
|
|
Serial.println("https://dev.xd0.de/hendrik/soundboard");
|
|
|
|
Serial.println("-------------------------------------");
|
|
|
|
}
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
bool touched = false;
|
|
|
|
for(int i=0; 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);
|
|
|
|
}
|