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.