Keyboard.println()
描述
送出按鍵內容給已連接的電腦,內容最後面接著新列符號與復位符號。
在呼叫 Keyboard.print()
函式之前,要先呼叫 Keyboard.begin() 函式。
注意:在您呼叫 Keyboard.print()
函式之後,86Duino 會接管您的鍵盤,模擬鍵盤按下按鍵的行為。建議在 86Duino 上透過外接開關,來切換電腦鍵盤和 86Duino 之間的控制權。
語法
Keyboard.println()
Keyboard.println(character)
Keyboard.println(characters)
參數
character
: 一個要送給電腦的 char 或 int 型別的字元。
characters
: 送給電腦的字串(相當於連續敲擊鍵盤按鍵)。
回傳
送出的 byte 個數
範例
void setup() { // 將 pin 2 設定為 INPUT_PULLUP 狀態 // 這樣它就會在外部按鈕被按下時 // 呈現 LOW 的狀態 pinMode(2, INPUT_PULLUP); Keyboard.begin(); } void loop() { // 假如按鍵被按下 if(digitalRead(2)==LOW){ // 送出一段訊息 Keyboard.println("Hello!"); delay(100); } }
See also
- Keyboard.begin()
- Keyboard.end()
- Keyboard.press()
- Keyboard.print()
- Keyboard.release()
- Keyboard.releaseAll()
- Keyboard.write()
The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.