esp32 soundboard project
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.

60 lines
1.1 KiB

/**
8 years ago
* ESP32 Soundboard
*
8 years ago
* Hendriks Projekt
*
8 years ago
* https://dev.xd0.de/hendrik/soundboard
*/
#include "Arduino.h"
8 years ago
#include "keyboard.h"
8 years ago
#include "sdcard.h"
#include "sound.h"
8 years ago
#define VERSION "0.0"
#define LED_PIN 21
8 years ago
Keyboard keyboard;
8 years ago
SDCard sdcard;
Sound sound;
8 years ago
void setup()
{
// initialize LED digital pin as an output.
pinMode(LED_PIN, OUTPUT);
Serial.begin(115200);
Serial.println("-------------------------------------");
Serial.print("Soundboard v.");
Serial.println(VERSION);
Serial.println("https://dev.xd0.de/hendrik/soundboard");
Serial.println("-------------------------------------");
keyboard.init();
8 years ago
sdcard.mount();
sound.init();
}
void loop()
{
8 years ago
bool touched = false;
for(int i=0; i<=9; i++) {
if (keyboard.getTouchDetected(i) == true) {
8 years ago
touched = true;
}
8 years ago
}
8 years ago
if (touched == true) {
// turn the LED on (HIGH is the voltage level)
digitalWrite(LED_PIN, HIGH);
sound.play();
8 years ago
} else {
// turn the LED off by making the voltage LOW
digitalWrite(LED_PIN, LOW);
sound.stop();
8 years ago
}
8 years ago
// wait for a second
8 years ago
delay(50);
}