Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: Adafruit Trellis and Teensy 3.2 with Audio Shield - communication problem

  1. #1
    Junior Member
    Join Date
    Jan 2019
    Posts
    4

    Adafruit Trellis and Teensy 3.2 with Audio Shield - communication problem

    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

  2. #2
    Senior Member
    Join Date
    Feb 2017
    Posts
    321
    Quote Originally Posted by hottib View Post
    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.

    Quote Originally Posted by hottib View Post
    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.

  3. #3
    Member houtson's Avatar
    Join Date
    Aug 2015
    Location
    Scotland
    Posts
    42
    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

  4. #4
    Junior Member
    Join Date
    Jan 2019
    Posts
    4

    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!

  5. #5
    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.

  6. #6
    Member houtson's Avatar
    Join Date
    Aug 2015
    Location
    Scotland
    Posts
    42
    Hello, post a picture of what you have and also the code you are using cheers Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •