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

Thread: Teensy3.2 not responding on USB-serial when A2 and A3 used in Audio library

  1. #1

    Teensy3.2 not responding on USB-serial when A2 and A3 used in Audio library

    Digging around in the Audio section of this forum, I found the answer, so I am adding this note: on what I think is the problem for anyone else running into the same issue ->
    OK, the Audio library is not set up for A3 . So the second AudioInput statement for A3 puts the Teensy in an undefined state and even the setup does not execute..


    on Teensy3.2 -> I am attempting to use the Audio
    mixer with two adc inputs, so I can mix adc1(A2) with ADC2(A3).
    (eventually I need to use mixer gain with a negative gain on A3)

    However, The moment I include the second audio input, the serial
    stops responding. I have included (modified from example ) code below.

    Q1: Can I use adc1(A2), adc2(A3) to feed into Mixer 0, 1, then
    use gain of -0.50 on adc2 connecting into mixer 1
    (Not in the code below -- but just asking)
    Q2: Why does the serial on fail? Is my Teensy3.2 or is it
    a "known" feature :-) Or ??


    __________ Code ______________________

    Serial Event example

    When new serial data arrives, this sketch adds it to a String.
    When a newline is received, the loop prints the string and
    clears it.

    A good test for this is to try it with a GPS receiver
    that sends out NMEA 0183 sentences.

    Created 9 May 2011
    by Tom Igoe

    This example code is in the public domain.

    #include <Audio.h>

    AudioInputAnalog adc1(A2);
    AudioInputAnalog adc2(A3); // un-comment to turn on Serial on Teensy3.2

    String inputString = ""; // a string to hold incoming data
    boolean stringComplete = false; // whether the string is complete

    void setup() {
    // initialize serial:
    // reserve 200 bytes for the inputString:

    void loop() {
    // print the string when a newline arrives:
    if (stringComplete) {
    // clear the string:
    inputString = "";
    stringComplete = false;

    SerialEvent occurs whenever a new data comes in the
    hardware serial RX. This routine is run between each
    time loop() runs, so using delay inside loop can delay
    response. Multiple bytes of data may be available.
    void serialEvent() {
    while (Serial.available()) {
    // get the new byte:
    char inChar = (char);
    // add it to the inputString:
    inputString += inChar;
    // if the incoming character is a newline, set a flag
    // so the main loop can do something about it:
    if (inChar == '\n') {
    stringComplete = true;

    Last edited by nhk; 08-25-2016 at 06:02 PM.

Posting Permissions

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