|
@@ -0,0 +1,54 @@
|
|
|
+#include <Audio.h>
|
|
|
+#include <Wire.h>
|
|
|
+#include <SPI.h>
|
|
|
+#include <SD.h>
|
|
|
+#include <SerialFlash.h>
|
|
|
+
|
|
|
+
|
|
|
+AudioPlaySdWav playWav1;
|
|
|
+AudioOutputI2S audioOutput;
|
|
|
+AudioConnection patchCord1(playWav1, 0, audioOutput, 0);
|
|
|
+AudioConnection patchCord2(playWav1, 1, audioOutput, 1);
|
|
|
+AudioControlSGTL5000 sgtl5000_1;
|
|
|
+
|
|
|
+// Use these with the Teensy Audio Shield
|
|
|
+#define SDCARD_CS_PIN 10
|
|
|
+#define SDCARD_MOSI_PIN 7
|
|
|
+#define SDCARD_SCK_PIN 14
|
|
|
+
|
|
|
+int buttonPins[11] = { 0, 1, 2, 3, 4, 5, 8, 16, 17, 20, 21 } ;
|
|
|
+//int buttonPin1 = 0 ;
|
|
|
+//int buttonPin2 = 1 ;
|
|
|
+
|
|
|
+//function prototypes
|
|
|
+void eventuallyContext();
|
|
|
+void trigSound(String);
|
|
|
+#include "evtActions.h"
|
|
|
+
|
|
|
+void setup() {
|
|
|
+// Serial.begin(9600) ;
|
|
|
+// Serial.println("started");
|
|
|
+
|
|
|
+ AudioMemory(8);
|
|
|
+ sgtl5000_1.enable();
|
|
|
+ sgtl5000_1.volume(0.5);
|
|
|
+
|
|
|
+ SPI.setMOSI(SDCARD_MOSI_PIN);
|
|
|
+ SPI.setSCK(SDCARD_SCK_PIN);
|
|
|
+ if (!(SD.begin(SDCARD_CS_PIN))) {
|
|
|
+ // stop here, but print a message repetitively
|
|
|
+ while (1) {
|
|
|
+// Serial.println("Unable to access the SD card");
|
|
|
+ delay(500);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i ; i<sizeof(buttonPins) ; i++ ) {
|
|
|
+ pinMode(buttonPins[i], INPUT_PULLUP);
|
|
|
+ }
|
|
|
+
|
|
|
+ eventuallyContext();
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+USE_EVENTUALLY_LOOP(mgr)
|