Adafruit Trellis and Teensy 3.2 with Audio Shield - communication problem

Status
Not open for further replies.

hottib

Member
Hello Everybody!
Very excited - it s my first post! I am using the trellis board/ Teensy 3.2 and the Audioshield. I wanna built a simple Sampler like: one trellis button turns on one sample (as an add on for my bass guitar)
I wrote this simple sketch to check if trellis triggers anything. It doesnt work :(
Is it an i2c issue or simply "newbiness"


here it is

#include <Bounce.h>
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

#include "Flute_100kbyte_samples.h"

AudioSynthWavetable wavetable;
AudioOutputI2S i2s1;
AudioMixer4 mixer;
AudioConnection patchCord1(wavetable, 0, mixer, 0);
AudioConnection patchCord2(mixer, 0, i2s1, 0);
AudioConnection patchCord3(mixer, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1;

// Trellis Zeug
#include <Wire.h>
#include "Adafruit_Trellis.h"
Adafruit_Trellis matrix0 = Adafruit_Trellis();
Adafruit_TrellisSet trellis = Adafruit_TrellisSet(&matrix0);
#define NUMTRELLIS 1
#define numKeys (NUMTRELLIS * 16)
#define INTPIN A2

void setup() {
Serial.begin(115200);

Wire.setSCL(16); // set i2c communication to other pins
Wire.setSDA(17); // set i2c communication to other pins
Wire.begin();// set i2c communication to other pins
Serial.println("Trellis Demo");

// begin() with the addresses of each panel in order
trellis.begin(0x70);
for (uint8_t i=0; i<numKeys; i++) {
trellis.setLED(i);
trellis.writeDisplay();
delay(50);
}
// then turn them off
for (uint8_t i=0; i<numKeys; i++) {
trellis.clrLED(i);
trellis.writeDisplay();
delay(50);
}

AudioMemory(20);
sgtl5000_1.enable();
sgtl5000_1.volume(0.8);
mixer.gain(0, 0.7);

wavetable.setInstrument(Flute_100kbyte);
wavetable.amplitude(1);

}

void loop() {
delay(30);
if (trellis.justPressed(0))
{
wavetable.playFrequency(261.0 );
wavetable.amplitude(0.7);
}

}


More failures form my past:
I tried the i2c on the other pins too.
I tired playing something form the SD.

.h and .cpp data is from Examples-> Audio -> synthesis -> Wavetable -> SimpleWavetable

Can anybody safe me from insanity?
<3
 
It doesnt work :(
Not very helpful problem statement. The code does something. Start by explaining what it does and how that is different from what you want it to do.

Hello Everybody!
Wire.setSCL(16); // set i2c communication to other pins
Wire.setSDA(17); // set i2c communication to other pins
The Audio Shield is controlled by I2C on Pins 18 & 19. So, this probably isn't a good idea.
 
Hi,

When I have used trellis with the Audio Shield I've used SDA0(18) and SCL0(19) and they seem to work fine on the same i2c pins as audio shield - try removing all the wire statements

In your sketch you also need to read the switch before you check for .justPressed like:
if (trellis.readSwitches()) {
if (trellis.justPressed(0)) { ....


Paul
 
Problem solved!

Hey Paul, thank you so much. You were right "trellis.readSwitches()" was missing. Now it runs beautifully. Now i m gonna solder the trellis on my Bassguitar. I let you guys know when the Project is finished.
@gfvalvo: THX for your help!
 
Hello Paul, please I also having trouble using the Teensy 3.6 with the neotrellis, it wouldn't even blink with all connections checked multiple times.
 
Status
Not open for further replies.
Back
Top