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

Thread: custom shortcut keyboard for Photoshop

  1. #1

    custom shortcut keyboard for Photoshop

    Hello Guys,

    I would like to create a custom shortcut keyboard for Photoshop with capacitive touch and a Teensy LC .

    For exemple :

    When I touch pin 0 > launch the shortcut 'Command + T'

    Can you guys help me with the code ?

    Thanks !
    Florent

  2. #2
    I think this page will help me https://www.pjrc.com/teensy/td_keyboard.html

  3. #3
    Senior Member
    Join Date
    Apr 2013
    Posts
    1,873
    That's the one
    For what you are after keeping things simple is the way to go, start with the examples, make sure you debounce your buttons properly and look at the keypad library if you are going beyond a single row of hotkeys and want more inputs without too much more complexity.

    And be very careful of your project typing into your code and ruining it, especially if you are doing ctl+things - you do not want select all/delete/save to fire on anything important! Suggestion is to put a toggle switch of some form on your project, and only send keypresses when that switch is in the 'arm' position.

  4. #4
    Thanks ! I still have no idea about how to proceed .. How to connect the function touch to a keyboard key ?

    Best

  5. #5
    Senior Member
    Join Date
    Apr 2013
    Posts
    1,873
    If you are using a button it is easy enough using examples like
    https://learn.adafruit.com/adafruit-...nputs/overview
    If you want this to be a capactivie sense/touch project you are looking at doing some filtering of your input to get repeatable results starting with
    http://little-scale.blogspot.com/201...touchread.html

    If the problem is how you actually send commands then you want to look at the keyboard examples in arduino->file->examples->teesny->usb keyboard - probably starting with buttons though you need to use ctl+key actions which will take a couple of iterations to get right.

  6. #6
    It's working !

    Code:
    int touchRead_pin = 0; 
    int data; 
    
    int thresh = 2800; 
    int play_flag = 0; 
    
    int current; 
    
    void setup() {
    
    }
    
    void loop() {
      current = touchRead(touchRead_pin); 
    
      if(current > thresh && play_flag == 0) {
        play_flag = 1;
         Keyboard.set_modifier(MODIFIERKEY_ALT | MODIFIERKEY_GUI); 
         Keyboard.send_now();
         Keyboard.press(KEY_W);
      }
      if(current < thresh && play_flag == 1) {
        play_flag = 0;
        Keyboard.set_modifier(0);
        Keyboard.set_key1(0);
        Keyboard.send_now(); 
        Keyboard.release(KEY_W); 
        delay(150);
      }
    }

Posting Permissions

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