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

Thread: running two macs with 2 teensy and Qlab

  1. #1
    Junior Member
    Join Date
    Feb 2018
    Posts
    10

    running two macs with 2 teensy and Qlab

    So I am currently able to mimic a spacebar on 2 Macbook pro's simultaneously. And I am trying to add an escape key.I have tried "we print esc" and that seems to do same as space but on pin 1, I also tried we print a h same deal mimics space bar on pin 1.Excuse my ignorance as this is new to me.
    FYI I am trying to find a simple way to trigger and escape out of two macs playing Qlab I have the go part down but code was already made. So now I am slowly learning. I can assign any key to do several things.
    Code:
    /*
     * Button.pde
     */
    
    void setup() {
      Serial.begin(9600);
      pinMode(10, INPUT_PULLUP);
      delay(5);
      pinMode(1, INPUT_PULLUP);
      delay(5);
    }
    
    void loop() {
      if (digitalRead(10) == HIGH) 
        delay(10);
      else 
        Keyboard.print(" "); // we print a space
        delay(10);
    
      if (digitalRead(1) == HIGH)
        delay(10);
     else 
        Keyboard.print(" "); // we print a h
      }
    
    
    
      // put your main code here, to run repeatedly:

  2. #2
    Junior Member
    Join Date
    Feb 2018
    Posts
    10
    Hello anyone ??

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,044
    Keyboard.press(KEY_ESC);
    Keyboard.release(KEY_ESC);

    Details here:

    https://www.pjrc.com/teensy/td_keyboard.html

    Also recommend using Bounce rather than digitalRead. Click File > Examples > Teensy > USB_Keyboard > MediaButtons

  4. #4
    Junior Member
    Join Date
    Feb 2018
    Posts
    10
    Thanks a lot that is exactly what I wanted. I don't understand the bounce part but I am slowly learning this.

  5. #5
    Junior Member
    Join Date
    Feb 2018
    Posts
    10
    Ok now I have A second question I am wondering if I can stack my 2 teensy 3.2's or lc's and wire my switches to the pins or sockets ? on the first unit I made the 2 teensy lc's are separate.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,044
    Quote Originally Posted by wallsofsound View Post
    wondering if I can stack my 2 teensy 3.2's or lc's and wire my switches to the pins or sockets ?
    I hope you can understand the guesswork that goes into trying to answer this sort of question. I'm guessing by "stack" you mean connecting all the pins between two Teensy boards? Also guessing the code looks similar to what you originally posted? Also assuming 2 USB cables from 2 computers?

    You definitely do want to connect the GND pins between the 2 boards.

    You should NOT connect the power pins (VIN, VUSB, 3.3V) between the boards, assuming each is powered by its own USB cable. The last thing you want to do is allow power from 1 computer to feed into the other.

    The two input pins for the button can probably be connected. The most conservative approach would use a double throw button (2 physical contacts). With both boards running with INPUT_PULLUP mode, there is a very tiny amount of power that might flow if one computer is turned off, but it's probably far too low to damage anything.

    The unused digital and analog pins can be connected between the boards.

    You should not connect the reset or program pins. You don't want one of them to reset or put the other into programming mode.

    This is all based on some guesswork about what you're doing. If you're connecting things differently than I've assumed, these answers could turn out to be wrong for some other circumstance than I've imagined.

  7. #7
    Junior Member
    Join Date
    Feb 2018
    Posts
    10
    Sorry about the lack of info But you seem to have nailed it. You understand what I meant to a T thanks.

Posting Permissions

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