說明
發送一條消息,說明先前按下的按鈕(通過 Mouse.press() 調用)已釋放。 Mouse.release()
默認為左鍵。
用法
Mouse.release()
Mouse.release(button)
參數
button
:按下哪個鼠標按鈕。允許的數據類型:char
。
-
MOUSE_LEFT
(默認) -
MOUSE_RIGHT
-
MOUSE_MIDDLE
返回
無
示例代碼
#include <Mouse.h>
void setup() {
//The switch that will initiate the Mouse press
pinMode(2, INPUT);
//The switch that will terminate the Mouse press
pinMode(3, INPUT);
//initiate the Mouse library
Mouse.begin();
}
void loop() {
//if the switch attached to pin 2 is closed, press and hold the left mouse button
if (digitalRead(2) == HIGH) {
Mouse.press();
}
//if the switch attached to pin 3 is closed, release the left mouse button
if (digitalRead(3) == HIGH) {
Mouse.release();
}
}
注意事項和警告
當您使用Mouse.release()
命令時,Arduino 會接管您的鼠標!在使用該命令之前,請確保您有控製權。切換鼠標控製狀態的按鈕是有效的。
相關用法
- Arduino Mouse.begin()用法及代碼示例
- Arduino Mouse.end()用法及代碼示例
- Arduino Mouse.click()用法及代碼示例
- Arduino Mouse.press()用法及代碼示例
- Arduino Mouse.isPressed()用法及代碼示例
- Arduino Mouse.move()用法及代碼示例
- Arduino Mouse - Mouse.click()用法及代碼示例
- Arduino Mouse - Mouse.press()用法及代碼示例
- Arduino Mouse - Mouse.isPressed()用法及代碼示例
- Arduino Mouse - Mouse.end()用法及代碼示例
- Arduino Mouse - Mouse.begin()用法及代碼示例
- Arduino Mouse - Mouse.move()用法及代碼示例
- Arduino Mouse - Mouse.release()用法及代碼示例
- Arduino MKRGSM - gprs.attachGPRS()用法及代碼示例
- Arduino MKRGSM - sms.read()用法及代碼示例
- Arduino MKRNB - getCurrentCarrier()用法及代碼示例
- Arduino MKRWAN - available()用法及代碼示例
- Arduino MKRNB - getIMEI()用法及代碼示例
- Arduino MKRWAN - version()用法及代碼示例
- Arduino MKRGSM - sms.print()用法及代碼示例
- Arduino MKRNB - endSMS()用法及代碼示例
- Arduino MKRGSM - client.connected()用法及代碼示例
- Arduino MKRGSM - voice.answerCall()用法及代碼示例
- Arduino MKRGSM - voice.hangCall()用法及代碼示例
- Arduino MKRGSM - sms.write()用法及代碼示例
注:本文由純淨天空篩選整理自arduino.cc大神的英文原創作品 Mouse.release()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。