Keyboard.release()

Last revision:2024/05/15

名称

Keyboard.release()

説明

指定したキーを離す。Keyboard.press()を参照のこと。

書式

Keyboard.release(key)

C言語シグネチャ(avr)

size_t Keyboard_::release(uint8_t k);

引数

k離す文字。データ型: char

戻り値

離したキーの数。

コード例

 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
31
#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.release(ctrlKey);
  Keyboard.release('n');
  // wait for new window to open:
  delay(1000);
}

オリジナルのページ

https://docs.arduino.cc/language-reference/en/functions/usb/Keyboard/keyboardRelease/

実装の解析

まだ解析していません。

最終更新日

July 20, 2026

inserted by FC2 system