use oled display conected with teensy 3.6 and audioshield

Status
Not open for further replies.

schuchi

Member
Hi guys, I want to use an oled display (with reset, DC pin etc.) together with the teensy audioshield on teensy 3.6 board. I use the SSD_13xx library (https://github.com/sumotoy/SSD_13XX). I can not receive any audio signal. Maybe it get in trouble because the audioshield and oled display use the same pins (f.e. pin 13, SCK. Do you have any idea to fix this problem or witch pins I can also use to run both?
 
Yes it is possible. You don't specify what type of display (i2C or SPI) you are going to use. But I have used I2C and connected it to pin 18 and 19. Works fine with the Adafruit_SSD1306 library.
 
The oled library uses SPI like the audioshield. I think i have to define other pins somewhere to use the other SPI pins on the Teensy 3.6. But I am beginner at c#, do you have an idea?
Yes, the I2C with the pin 18,19 works with the audioshield and display . But the SSd1306 library seems to be realy slow (50ms).
 
I believe you would need to use the same SPI pins that the audio shield uses for MOSI/MISO/SCLK

I'm not familiar with sumotoy's library, and whether it has options for using alternate SCLK, MISO, MOSI.

You will need to use the CS/DC pins from among pins that aren't used by the audio shield. For displays, there are optimizations that use the special hardware CS pins (both CS and DC need to be in those pins, but a reset pin does not need to use the fast pins):
  • Pin 9: Used by the audio shield
  • Pin 10: Used by the audio shield
  • Pin 15/A1: Used by the audio shield
  • Pin 20/A6: This pin is not used by the audio shield
  • Pin 21/A7: This pin is not used by the audio shield

So you need to use pins 20/21 for CS and DC.
 
Thank you, the display stuff is working. But I can not receive audio with the queue, I only receive -1??
Code:
/*
      A benchmark Test, on Teensy it will also check if pin you choose are legal
    Version 1.11 (better screenFill test, test in rotation 0...3, fixed test lines results)
*/
#include <Audio.h>
#include <Wire.h>   //serielle communication mit arduino
#include <SPI.h>
#include <SerialFlash.h>
#include <SSD_13XX.h>
#include "_icons/wifi.c"

#if defined(__SAM3X8E__)
#undef __FlashStringHelper::F(string_literal)
#define F(string_literal) string_literal
#endif

uint8_t errorCode = 0;
#define _dlyBetweenTests  500

/*
  Teensy3.x and Arduino's
  You are using 4 wire SPI here, so:
  MOSI:  11//Teensy3.x/Arduino UNO (for MEGA/DUE refere to arduino site)
  MISO:  12//Teensy3.x/Arduino UNO (for MEGA/DUE refere to arduino site)
  SCK:   13//Teensy3.x/Arduino UNO (for MEGA/DUE refere to arduino site)
  ESP8266-----------------------------------
  Use:
  #define __CS  16  //(D0)
  #define __DC  5   //(D1)
  #define __RST 4   //(D2)

  SCLK:D5
  MOSI:D7
*/
#if defined(ESP8266)
#define __CS1   4  //GPIO4 or GPIO2
#define __DC   5  //(D1)
#else
#define __CS1   20
#define __DC  21
#endif

SSD_13XX tft = SSD_13XX(__CS1, __DC);

// GUItool: begin automatically generated code
AudioInputI2S            i2s1;           //xy=170,126
AudioRecordQueue         queue1;         //xy=977,264
AudioOutputI2S           i2s2;           //xy=1051,188
AudioConnection          patchCord1(i2s1, 0, queue1, 0);
AudioConnection          patchCord2(i2s1, 0, i2s2, 0);
AudioConnection          patchCord3(i2s1, 0, i2s2, 1);
AudioControlSGTL5000     AudioShield;     //xy=424,439
// GUItool: end automatically generated code

const int myInput = AUDIO_INPUT_MIC;
int16_t Signal;

void setup() {
   AudioShield.enable();
  AudioShield.inputSelect(myInput);
  AudioShield.volume(0.75);
  AudioMemory(10);
  queue1.begin();
  AudioShield.micGain(60);   
  Serial.begin(38400);
  tft.begin();
  tft.setBrightness(15);
}
void loop() {

 if (queue1.available() >= 1) // check if a package is available; 
  {                           
     Serial.println("test");
 Signal=  *queue1.readBuffer(); 
  Serial.println(Signal);
  queue1.freeBuffer();

  
  }
   testText();
}

void testText() {
  tft.clearScreen();
  tft.setCursor(0, 0);
  tft.setTextColor(WHITE);
  tft.setTextScale(1);
  tft.println("Hello World!");
  tft.setTextColor(YELLOW);
}
 
Status
Not open for further replies.
Back
Top