diff --git a/Portable_Trellis_Soundboard/TrellisSound/TrellisSound.ino b/Portable_Trellis_Soundboard/TrellisSound/TrellisSound.ino new file mode 100644 index 000000000..fe4aad785 --- /dev/null +++ b/Portable_Trellis_Soundboard/TrellisSound/TrellisSound.ino @@ -0,0 +1,149 @@ +#include +#include "Adafruit_Trellis.h" +#include +#include "Adafruit_Soundboard.h" + +/************ sound board setup ***********/ +// Choose any two pins that can be used with SoftwareSerial to RX & TX +#define SFX_TX 5 +#define SFX_RX 6 +// Connect to the RST pin on the Sound Board +#define SFX_RST 4 + +#define SFX_ACT 1 // the 'ACT'ivity LED, to tell us if we're still playing + +// You can also monitor the ACT pin for when audio is playing! +// we'll be using software serial +SoftwareSerial ss = SoftwareSerial(SFX_TX, SFX_RX); +// pass the software serial to Adafruit_soundboard, the second +// argument is the debug port (not used really) and the third +// arg is the reset pin +Adafruit_Soundboard sfx = Adafruit_Soundboard(&ss, NULL, SFX_RST); + +/************ Trellis setup ***********/ + +Adafruit_Trellis matrix0 = Adafruit_Trellis(); +Adafruit_TrellisSet trellis = Adafruit_TrellisSet(&matrix0); + +// set to however many you're working with here, up to 8 +#define NUMTRELLIS 1 +#define numKeys (NUMTRELLIS * 16) + +// Connect Trellis Vin to 5V and Ground to ground. +// Connect the INT wire to pin #A2 (can change later!) +#define INTPIN A2 +// Connect I2C SDA pin to your Arduino SDA line +// Connect I2C SCL pin to your Arduino SCL line + + +char PadToTrack[numKeys][12] = {"T00RAND0WAV", + "T00RAND1WAV", + "T00RAND2WAV", + "T00RAND3WAV", + "T10HOLDLWAV", + +}; + +/************ main setup ***********/ + +void setup() { + Serial.begin(115200); + Serial.println("Trellis Demo"); + + // INT pin requires a pullup + pinMode(INTPIN, INPUT); + digitalWrite(INTPIN, HIGH); + // ACT LED + pinMode(SFX_ACT, INPUT); + digitalWrite(SFX_ACT, HIGH); //pullup + + // begin() with the addresses of each panel in order + trellis.begin(0x70); // only one + + // light up all the LEDs in order + for (uint8_t i=0; i