Skip to content

Instantly share code, notes, and snippets.

@tokyoff
Last active August 24, 2019 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tokyoff/8ae0dca8e845b668859758e47f605894 to your computer and use it in GitHub Desktop.
Save tokyoff/8ae0dca8e845b668859758e47f605894 to your computer and use it in GitHub Desktop.
オラオラオラオラ... とひたすら入力できるワンボタンキーボード用ソースコード
//------------------------------------
// オラオラオラオラ キーボード
// ※日本語入力ONの状態でキーを押すこと
// 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.print("ora"); // "おら"入力
delay(10); // 10ms待つ
Keyboard.press(KEY_F8); // 半角カナ変換
delay(10); // 10ms待つ
Keyboard.releaseAll(); // すべて放す
Keyboard.press(KEY_RETURN); // リターン
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