diff --git a/TrellisSoundBoard.ino b/TrellisSoundBoard.ino new file mode 100644 index 0000000..116e910 --- /dev/null +++ b/TrellisSoundBoard.ino @@ -0,0 +1,174 @@ +#include +#include "Adafruit_Trellis.h" +#include +#include "Adafruit_Soundboard.h" + +// Sound FX Board setup +#define SFX_TX 9 +#define SFX_RX 10 +#define SFX_RST 4 +#define SFX_ACT A1 + +SoftwareSerial ss = SoftwareSerial(SFX_TX, SFX_RX); +Adafruit_Soundboard sfx = Adafruit_Soundboard(&ss, NULL, SFX_RST); + +// Trellis setup +#define INTPIN A2 + +Adafruit_Trellis matrix0 = Adafruit_Trellis(); +Adafruit_TrellisSet trellis = Adafruit_TrellisSet(&matrix0); + +#define NUMTRELLIS 1 +#define numKeys (NUMTRELLIS * 16) + +// Sketch-specific global variables +char page1TrackNames[12][12] = { + "DOIT OGG", + "MAKEIT OGG", + "WORKIT OGG", + "", + "HARDER OGG", + "BETTER OGG", + "FASTER OGG", + "STRONGEROGG", +}; +char page2TrackNames[12][12] = { + "CRICK OGG", + "FAIL OGG", + "BITEASS OGG", + "MARIO OGG", + "PADUM OGG", + "PHONE OGG", + "WINNER OGG", + "WRONG OGG" +}; +char page3TrackNames[12][12] = { + "WRONG OGG" +}; +char page4TrackNames[12][12] = { + "WRONG OGG" +}; +int alternate[16] = {0,2,5,7,8,10,13,15,1,3,4,6,9,11,12,14}; +int selectedPage = 12; + +void setup() { + Serial.begin(115200); +// Serial.println("Trellis Demo"); + + pinMode(INTPIN, INPUT); + digitalWrite(INTPIN, HIGH); + pinMode(SFX_ACT, INPUT); + digitalWrite(SFX_ACT, HIGH); //pullup + + trellis.begin(0x70); + + // Test/showoff all leds + for (uint8_t i=0; i<16; i++) { + trellis.setLED(alternate[i]); + trellis.writeDisplay(); + delay(50); + } + trellis.blinkRate(1); + + // softwareserial at 9600 baud + ss.begin(9600); + + if (!sfx.reset()) { + Serial.println("SFX not found"); + while (1); + } + Serial.println("SFX board found"); +/* do { + currentVolume = sfx.volDown(); + Serial.print("Lowering volume to: "); Serial.println(currentVolume); + } while (currentVolume > MINVOLUME); +*/ + + uint8_t files = sfx.listFiles(); + Serial.println("===== File Listing ====="); + Serial.print("Found "); Serial.print(files); Serial.println(" Files"); + for (uint8_t f=0; f