Keyboard.release()

설명

Lets go of the specified key. See Keyboard.press() for more information.

문법

Keyboard.release(key)

매개변수

  • key : the key to release. char

반환값

  • size_t : the number of keys released

예제 코드

#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); }

ARDUINO BUY RECOMMENDATION

Arduino UNO R3
Arduino Starter Kit
Disclosure: Some links in this section are Amazon affiliate links. If you make a purchase through these links, we may earn a commission at no extra cost to you.
Additionally, some links direct to products from our own brand, DIYables.

※ OUR MESSAGES