Keyboard.println()

名称

Keyboard.println()

説明

接続しているPCに一つ以上のキーストロークと、その後、改行と復帰コードを送信する。

Keyboard.println()を使う前に、Keyboard.begin()を呼ぶ必要がある。

書式

size_t Keyboard_::println(const char[]);

size_t Keyboard_::println(char);

引数

char送信する文字、文字列。

戻り値

送信したバイト数。

使用例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include <Keyboard.h>

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);
  Keyboard.begin();
}

void loop() {
  //if the button is pressed
  if (digitalRead(2) == LOW) {
    //Send the message
    Keyboard.println("Hello!");
  }
}

注意

Keyboard.println()コマンドを使うと、Arduinoはキーボードを横取りする。このコマンドを使う前に制御可能であることを確認すること。キーボード制御状態をトグルする押しボタンを使うのが効果がある。

参照

オリジナルのページ

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

Last Revision: 2021/11/06

実装の解析

まだ解析していません。

最終更新日

January 4, 2024

inserted by FC2 system