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

Thread: Audio and ILI9341_t3 library conflict

  1. #1

    Audio and ILI9341_t3 library conflict

    I am using a Teensy 3.6 and trying to use both the audio library with the touchscreen tft lcd library. I have the Color 320x240 TFT Touchscreen and am following the hookup instructions on that page under "Usage With Audio Board Connections". For the audio side, I am using Audio Adaptor Board for Teensy connected to an amplifier from Adafruit which is then connected to a small 4ohm speaker.

    Uploading the example sketches from the Arduino IDE to the Teensy for both the LCD and the Audio work fine and as expected. Even combining them they are fine so long as I do the LCD stuff before the audio stuff. The problem begins the moment I try to change the LCD after initializing the Audio board. The problem manifests as the speaker playing a screeching noise or farting noise sometimes before becoming screeching. The tone sounds different each time but I don't have a trained ear to resolve this.

    I assume that these have been used together since there is a note about changing pins on the website but can't seem to figure this one out. I have simplified the sketch into the below code for people to reproduce. Any suggestions?

    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    #include <ILI9341_t3.h>
    #include "AudioSampleGong.h"  // sample file from example "SamplePlayer"
    #define TFT_DC      20
    #define TFT_CS      21
    #define TFT_RST    255  // 255 = unused, connect to 3.3V
    #define TFT_MOSI     7
    #define TFT_SCLK    14
    #define TFT_MISO    12
    ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_MISO);
    AudioPlayMemory    sound4;
    AudioMixer4        mix2;  
    AudioOutputI2S     headphones;
    AudioConnection    c6(sound4, 0, mix2, 1);
    AudioConnection    c8(mix2, 0, headphones, 0);
    AudioControlSGTL5000 audioShield;
    void setup() {
      mix2.gain(1, 0.4);
    void loop() {;
        Serial.println("test point 1");
        tft.fillScreen(ILI9341_GREEN);  // problem begins on this line
        Serial.println("test point 2");

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    For a working example, take a look at the last part of the audio tutorial.

    That part starts on page 30 of the PDF. In the walkthrough video, you can see it working starting at 45:30. The tutorial code is available in Arduino by clicking File > Examples > Audio > Tutorial.

    You can see it definitely does update the display with those 2 level bars & text, while the audio library is also using the same SPI pins to access the SD card, and of course playing the sound through the audio shield. Hopefully a known good example helps?

  3. #3
    I read through the tutorial (very good tutorials btw!) and started with the Part_3_03_TFT_Display sketch. I do not have an SD on hand so I had to change it to read from memory. Unfortunately, I saw the same screeching behavior. Since I did change it to play from memory, maybe that is different? I will hunt down an SD to try that next.

Posting Permissions

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