|
- #include <Audio.h>
- #include <SD.h>
-
-
-
-
-
-
-
- const int milliseconds = 3500;
-
-
- AudioPlaySdWav playSdWav4;
- AudioPlaySdWav playSdWav3;
- AudioPlaySdWav playSdWav5;
- AudioPlaySdWav playSdWav6;
- AudioPlaySdWav playSdWav2;
- AudioPlaySdWav playSdWav1;
- AudioMixer4 mixer1;
- AudioMixer4 mixer2;
- AudioOutputI2S i2s1;
- AudioConnection patchCord1(playSdWav4, 0, mixer1, 3);
- AudioConnection patchCord2(playSdWav3, 0, mixer1, 2);
- AudioConnection patchCord3(playSdWav5, 0, mixer2, 1);
- AudioConnection patchCord4(playSdWav6, 0, mixer2, 2);
- AudioConnection patchCord5(playSdWav2, 0, mixer1, 1);
- AudioConnection patchCord6(playSdWav1, 0, mixer1, 0);
- AudioConnection patchCord7(mixer1, 0, mixer2, 0);
- AudioConnection patchCord8(mixer2, 0, i2s1, 0);
- AudioConnection patchCord9(mixer2, 0, i2s1, 1);
- AudioControlSGTL5000 sgtl5000_1;
-
-
-
- #define SDCARD_CS_PIN 10
- #define SDCARD_MOSI_PIN 7
- #define SDCARD_SCK_PIN 14
-
-
-
-
-
-
-
-
-
-
-
- void setup() {
- AudioMemory(40);
- sgtl5000_1.enable();
- sgtl5000_1.volume(0.6);
- mixer1.gain(0, 0.167);
- mixer1.gain(1, 0.167);
- mixer1.gain(2, 0.167);
- mixer1.gain(3, 0.167);
- mixer2.gain(0, 1.0);
- mixer2.gain(1, 0.167);
- mixer2.gain(2, 0.167);
-
- SPI.setMOSI(SDCARD_MOSI_PIN);
- SPI.setSCK(SDCARD_SCK_PIN);
- if (!(SD.begin(SDCARD_CS_PIN))) {
-
- while (1) {
- Serial.println("Unable to access the SD card");
- delay(500);
- }
- }
- }
-
- AudioPlaySdWav * const playerlist[6] = {
- &playSdWav1, &playSdWav2, &playSdWav3, &playSdWav4, &playSdWav5, &playSdWav6
- };
-
- void playNumber(int n)
- {
- String filename = String("NUM") + n + ".WAV";
- Serial.print("Playing File: ");
- Serial.println(filename);
- Serial.flush();
- playerlist[n % 6]->play(filename.c_str());
- }
-
- void loop() {
- for (int i=1; i <= 6; i++) {
- playNumber(i);
- delay(milliseconds);
- }
- }
|