Created
September 12, 2019 14:31
-
-
Save tokyoff/3aed0b8be6b66cdc229c96dd8baae623 to your computer and use it in GitHub Desktop.
書式なし貼り付けができるワンボタンキーボード用ソースコード(Mac用)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------------------------ | |
// 書式なし貼り付けキーボード Mac用 | |
// (command + shift + option + v) | |
// https://www.one-button-key.com/ | |
//------------------------------------ | |
#include "Keyboard.h" | |
#define PIN_KEYSW (9) | |
int prevKeyState; | |
int currKeyState; | |
void setup() { | |
pinMode(PIN_KEYSW, INPUT_PULLUP); | |
prevKeyState = HIGH; | |
currKeyState = HIGH; | |
Keyboard.begin(); | |
} | |
void loop() { | |
currKeyState = digitalRead(PIN_KEYSW); | |
// キースイッチが押された | |
if ((prevKeyState == HIGH) && (currKeyState == LOW)) { | |
Keyboard.press(KEY_LEFT_GUI); // command | |
Keyboard.press(KEY_LEFT_SHIFT); // shift | |
Keyboard.press(KEY_LEFT_ALT); // option | |
Keyboard.press('v'); // v | |
delay(10); // 10ms待つ | |
Keyboard.releaseAll(); // すべて放す | |
} | |
prevKeyState = currKeyState; | |
delay(10); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment