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

Thread: How to get Teensy 3.2 to trigger a 'ground' without a transistor

  1. #1

    How to get Teensy 3.2 to trigger a 'ground' without a transistor

    Is there a way to configure a Teensy 3.2 A/D 'x' pin to become a switchable ground without adding an external transistor (ex 3904)?

    For example:

    If I have a sound board that needs pin x grounded to trigger a file play, is it possible to configure the Teensy 3.2 to use say pin 18 to switch to ground when 'activated?' (it would go from neutral to ground) I do not know if there are any built in transistors on the Teensy that can be configured to work with the specific pin like this.....(this is different than pull up or pull down resistors)


    Thx

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,558
    The keyword is open drain...

  3. #3
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,546
    to be exact, pinMode(pin, OUTPUT_OPENDRAIN)

  4. #4
    THX for replies! OK so I tried code below and there is 3.2v when HIGH on pin 13 and 10, and both go to 0 when LOW. HIGH on OUTPUT_OPENDRAIN does not seem to create an isolated pin (is there a MEDIUM?). Both pins will trigger the sound board when going to 0v, and Interestingly, the 3.2v output during HIGH does not seem to effect the sound board. It must have reverse V protection. But I would rather not send the +3.2v back to the sound board......so set-up really seems to need a 'switch' to isolate the ground trigger....

    Code:
      
    int led = 13;
    int audio = 10;
    
    // the setup routine runs once when you press reset:
    void setup() {                
      // initialize the digital pin as an output.
      pinMode(led, OUTPUT);    
      pinMode(audio , OUTPUT_OPENDRAIN) ;
    }
    
    // the loop routine runs over and over again forever:
    void loop() {
      
      digitalWrite(led, HIGH);  
      delay(1000);   
      
      digitalWrite(audio, HIGH);   
      delay(1000); 
    
      digitalWrite(led, LOW);    
      delay(1000);     
    
      
      digitalWrite(audio, LOW);     
      delay(1000); 
    
      
    }

Posting Permissions

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