CapranDreams
New member
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?
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?
Code:
#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() {
tft.begin();
tft.setRotation(0);
tft.fillScreen(ILI9341_BLACK);
AudioMemory(10);
audioShield.enable();
audioShield.volume(0.4);
mix2.gain(1, 0.4);
}
void loop() {
sound4.play(AudioSampleGong);
delay(1000);
Serial.println("test point 1");
tft.fillScreen(ILI9341_GREEN); // problem begins on this line
delay(1000);
Serial.println("test point 2");
}