Keyboard.releaseAll()

名称

Keyboard.releaseAll()

説明

押されているすべてのキーを離す。Keyboard.press()を参照のこと。

書式

void Keyboard_::releaseAll(void);

引数

なし。

戻り値

なし。

使用例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <Keyboard.h>

// use this option for OSX:
char ctrlKey = KEY_LEFT_GUI;
// use this option for Windows and Linux:
//  char ctrlKey = KEY_LEFT_CTRL;

void setup() {
  // make pin 2 an input and turn on the
  // pullup resistor so it goes high unless
  // connected to ground:
  pinMode(2, INPUT_PULLUP);
  // initialize control over the keyboard:
  Keyboard.begin();
}

void loop() {
  while (digitalRead(2) == HIGH) {
    // do nothing until pin 2 goes low
    delay(500);
  }
  delay(1000);
  // new document:
  Keyboard.press(ctrlKey);
  Keyboard.press('n');
  delay(100);
  Keyboard.releaseAll();
  // wait for new window to open:
  delay(1000);
}

参照

オリジナルのページ

https://www.arduino.cc/reference/en/language/functions/usb/keyboard/keyboardreleaseall/

Last Revision: 2019/02/21

実装の解析

まだ解析していません。

最終更新日

January 4, 2024

inserted by FC2 system