Mouse.click()
描述
送出敲擊(先按下然後放開)滑鼠鍵的命令給電腦。
Mouse.click()
預設是滑鼠左鍵。
注意:當你使用 Mouse.click()
函式後,86Duino 會接管你的滑鼠游標,使它做出敲擊按鍵的行為(使用此函式前,請確認實體滑鼠運作是沒問題的)。 建議你可以在程式中,判斷一個外接按鈕是否按下,來決定是否送出敲擊 86Duino 滑鼠的命令。
語法
Mouse.click();
Mouse.click(button);
參數
button
:要敲擊哪一個按鍵 – char 型別
-MOUSE_LEFT
(預設)
-MOUSE_RIGHT
-MOUSE_MIDDLE
回傳
無回傳值
範例
void setup(){ pinMode(2,INPUT); // 初始化 HID 滑鼠函式庫 Mouse.begin(); } void loop(){ // 外部按鈕被按下後,送出敲擊滑鼠左鍵的命令 if(digitalRead(2) == HIGH){ Mouse.click(); } }
See also
- Mouse.begin()
- Mouse.end()
- Mouse.move()
- Mouse.press()
- Mouse.release()
- Mouse.isPressed()
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.