|
|
@ -24,6 +24,9 @@ static const char *soundFile[3][3] = {{"/T0.wav", "/T1.wav", "/T2.wav"}, |
|
|
|
{"/T3.wav", "/T4.wav", "/T5.wav"}, |
|
|
|
{"/T6.wav", "/T7.wav", "/T8.wav"}}; |
|
|
|
|
|
|
|
unsigned long lastDebounceTime = 0; // the last time the output pin was toggled
|
|
|
|
unsigned long debounceDelay = 100; // the debounce time
|
|
|
|
|
|
|
|
void setup() |
|
|
|
{ |
|
|
|
// initialize LED digital pin as an output.
|
|
|
@ -42,23 +45,24 @@ void setup() |
|
|
|
|
|
|
|
static const char *bootSound = "/boot.wav"; |
|
|
|
|
|
|
|
//xTaskCreate(&(Sound::play_task), "play_task", 3072, (void*)bootSound, 5, &xTaskSound);
|
|
|
|
sound.play(bootSound); |
|
|
|
|
|
|
|
// keyboard.setCallback(0, [&soundFile]() {int i=0; sound.play(soundFile[i/3][i%3]);});
|
|
|
|
// keyboard.setCallback(1, []() {Serial.println("interrupt 1");});
|
|
|
|
} |
|
|
|
|
|
|
|
void loop() |
|
|
|
{ |
|
|
|
bool touched = false; |
|
|
|
bool playing = false; |
|
|
|
for(int i=0; i<=9; i++) { |
|
|
|
if (keyboard.getTouchDetected(i) == true) { |
|
|
|
touched = true; |
|
|
|
Serial.print("touch "); |
|
|
|
Serial.println(i, DEC); |
|
|
|
if (playing == false) { |
|
|
|
playing == true; |
|
|
|
Serial.println("main loop touched==true: new task"); |
|
|
|
if ((millis() - lastDebounceTime) > debounceDelay) { |
|
|
|
lastDebounceTime = millis(); |
|
|
|
Serial.println("main loop touched==true: play new sound"); |
|
|
|
sound.play(soundFile[i/3][i%3]); |
|
|
|
} |
|
|
|
Serial.print("touch "); |
|
|
|
Serial.println(i, DEC); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -71,6 +75,6 @@ void loop() |
|
|
|
} |
|
|
|
|
|
|
|
wifi.loop(); |
|
|
|
// wait for a second
|
|
|
|
// wait for a moment
|
|
|
|
delay(50); |
|
|
|
} |
|
|
|