Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTRL+C, CTRL+V and SHIFT+ALT. #38

Closed
c7v opened this issue Oct 9, 2023 · 1 comment
Closed

CTRL+C, CTRL+V and SHIFT+ALT. #38

c7v opened this issue Oct 9, 2023 · 1 comment

Comments

@c7v
Copy link

c7v commented Oct 9, 2023

Hi, tell me how to write the code to execute the keys: CTRL+C, CTRL+V and SHIFT+ALT?

@c7v
Copy link
Author

c7v commented Oct 9, 2023

#include <TrinketHidCombo.h>

#define USB_CFG_DEVICE_NAME 'S', 'o', 'k', 'o', 'l', 'o', 'v' 's', 'k', 'y', ' ','P','A','D',
#define USB_CFG_DEVICE_NAME_LEN 15

#define PIN_BTN_A 0
#define PIN_BTN_B 2

void setup()
{
  pinMode(PIN_BTN_A, INPUT_PULLUP);
  pinMode(PIN_BTN_B, INPUT_PULLUP);

  TrinketHidCombo.begin();
}

void loop()
{
  uint32_t now = millis();

  if (!digitalRead(PIN_BTN_A) && !digitalRead(PIN_BTN_B))
  {
    TrinketHidCombo.pressKey(KEYCODE_MOD_LEFT_CONTROL, KEYCODE_A);
  } else {

   if (!digitalRead(PIN_BTN_B))
  {
     TrinketHidCombo.pressKey(KEYCODE_MOD_LEFT_CONTROL, KEYCODE_C);
  }

  if (!digitalRead(PIN_BTN_A))
  {
    TrinketHidCombo.pressKey(KEYCODE_MOD_LEFT_CONTROL, KEYCODE_V);
  }
  }

  
  TrinketHidCombo.pressKey(0, 0);
  TrinketHidCombo.poll();
  delay(100);
}

@c7v c7v closed this as completed Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant