I'm sorry this question is so lame, but could someone help me with changing the code of this drum program from playing sounds triggered from a button/switch on digital pins 1, 2 and 3 to a piezo on analog pins A14, A15 and A16?
Here is the code. It works fine but I want to change it to analog.
I am not attaching the source sound files since they are linking to the program and working fine.
Here is the code. It works fine but I want to change it to analog.
I am not attaching the source sound files since they are linking to the program and working fine.
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioPlayMemory playMem3; //xy=269,225
AudioPlayMemory playMem1; //xy=289,373
AudioPlayMemory playMem2; //xy=293,297
AudioMixer4 mixer1; //xy=742,272
AudioOutputI2S Audio_Board_Output; //xy=1031,274
AudioConnection patchCord1(playMem3, 0, mixer1, 0);
AudioConnection patchCord2(playMem1, 0, mixer1, 3);
AudioConnection patchCord3(playMem2, 0, mixer1, 1);
AudioConnection patchCord4(mixer1, 0, Audio_Board_Output, 0);
AudioConnection patchCord5(mixer1, 0, Audio_Board_Output, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=591,435
// GUItool: end automatically generated code
#include "AudioSampleC1_drum.h"
boolean previousC1_drumButtonStatus = false;
unsigned long previousC1_drumTime = 0;
//six more lines from magazine
void setup()
{
AudioMemory(10);
sgtl5000_1.enable();
sgtl5000_1.volume(0.5);
pinMode(2, INPUT_PULLUP);
}
void loop()
{
boolean newC1_drumButtonStatus = !digitalRead(2);
if(newC1_drumButtonStatus !=
previousC1_drumButtonStatus && millis() >
previousC1_drumTime + 30) {
if(newC1_drumButtonStatus) playMem1.play(AudioSampleC1_drum);
previousC1_drumButtonStatus = newC1_drumButtonStatus;
previousC1_drumTime = millis();
}
}