說明
向連接的計算機發送一個或多個擊鍵,然後按 Enter 鍵。
Keyboard.println()
必須在啟動 Keyboard.begin() 之後調用。
用法
Keyboard.println()
Keyboard.println(character)
Keyboard.println(characters)
參數
character
: 一個字符或 int 作為擊鍵發送到計算機,然後按 Enter。
characters
:要作為擊鍵發送到計算機的字符串,然後按 Enter。
返回
發送的擊鍵次數。數據類型:size_t
。
示例代碼
#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 將接管您的鍵盤!在使用該命令之前,請確保您有控製權。切換鍵盤控製狀態的按鈕有效。
相關用法
- Arduino Keyboard.print()用法及代碼示例
- Arduino Keyboard.press()用法及代碼示例
- Arduino Keyboard.releaseAll()用法及代碼示例
- Arduino Keyboard.write()用法及代碼示例
- Arduino Keyboard.begin()用法及代碼示例
- Arduino Keyboard.release()用法及代碼示例
- Arduino Keyboard.end()用法及代碼示例
- Arduino long用法及代碼示例
- Arduino Arduino_EMBRYO_2 - setLengthXY()用法及代碼示例
- Arduino ~用法及代碼示例
- Arduino ArduinoBLE - bleDevice.advertisedServiceUuidCount()用法及代碼示例
- Arduino const用法及代碼示例
- Arduino Ethernet - server.begin()用法及代碼示例
- Arduino ArduinoBLE - BLEService()用法及代碼示例
- Arduino digitalWrite()用法及代碼示例
- Arduino ArduinoBLE - bleCharacteristic.subscribe()用法及代碼示例
- Arduino Servo - attach()用法及代碼示例
- Arduino write()用法及代碼示例
- Arduino Arduino_LSM9DS1 - readGyroscope()用法及代碼示例
- Arduino ArduinoSound - FFTAnalyzer.input()用法及代碼示例
- Arduino MKRGSM - gprs.attachGPRS()用法及代碼示例
- Arduino WiFiNINA - WiFi.config()用法及代碼示例
- Arduino MKRGSM - sms.read()用法及代碼示例
- Arduino MKRNB - getCurrentCarrier()用法及代碼示例
- Arduino Scheduler - Scheduler.startLoop()用法及代碼示例
注:本文由純淨天空篩選整理自arduino.cc大神的英文原創作品 Keyboard.println()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。