Thanks for the interrupt idea. I think that will help to reduce any erratic response to the touch function. On another note, I am having trouble with the original external button input function of Paul's Audio Workshop (Part_03_02_Fourier_Transform) listed below.
button0.update();
button1.update();
button2.update();
// Left button starts playing a new song
if (button0.fallingEdge()) {
mixer1.gain(2, 0.0);
mixer1.gain(3, 0.0);
fileNumber = fileNumber + 1;
if (fileNumber >= 4) fileNumber = 0;
playMem1.stop();
playSdWav1.play(filenames[fileNumber]);
mixer1.gain(0, 0.5);
mixer1.gain(1, 0.5);
}
I am now transferring these mode inputs to the XPT2046 display touch mode buttons with different variable names (i.e. button0 = audmode, button1 = seqmode, etc.). The only renamed mode that does not work is button0 with executing "playSdWav1.play(filenames[fileNumber]);". What I am wondering is if the SD.h or audio.h library expects the specific "button0" variable to be passed instead of my new variable name "audmode". If not, maybe it has more to do with the button0.update(); function as it is not being used due to no external switch input. Any ideas on this?
button0.update();
button1.update();
button2.update();
// Left button starts playing a new song
if (button0.fallingEdge()) {
mixer1.gain(2, 0.0);
mixer1.gain(3, 0.0);
fileNumber = fileNumber + 1;
if (fileNumber >= 4) fileNumber = 0;
playMem1.stop();
playSdWav1.play(filenames[fileNumber]);
mixer1.gain(0, 0.5);
mixer1.gain(1, 0.5);
}
I am now transferring these mode inputs to the XPT2046 display touch mode buttons with different variable names (i.e. button0 = audmode, button1 = seqmode, etc.). The only renamed mode that does not work is button0 with executing "playSdWav1.play(filenames[fileNumber]);". What I am wondering is if the SD.h or audio.h library expects the specific "button0" variable to be passed instead of my new variable name "audmode". If not, maybe it has more to do with the button0.update(); function as it is not being used due to no external switch input. Any ideas on this?