Mouse.release()

名称

Mouse.release()

説明

(Mouse.press()によって)前に押されたボタンを離すためのメッセージを送信する。

Mouse.release()は、デフォルトでは、左ボタンを離す。

書式

void Mouse_::release(uint8_t b = MOUSE_LEFT);

引数

bマウスのどのボタンを離すかを指定する。
MOUSE_LEFT:左ボタン(デフォルト)。
MOUSE_RIGHT:右ボタン。
MOUSE_MIDDLE:中ボタン。

戻り値

なし。

使用例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#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はマウスを横取りする。このコマンドを使う前に制御可能であることを確認すること。マウス制御状態をトグルする押しボタンを使うのが効果がある。

参照

言語 Mouse.click()

言語 Mouse.end()

言語 Mouse.move()

言語 Mouse.press()

言語 Mouse.isPressed()

オリジナルのページ

https://www.arduino.cc/reference/en/language/functions/usb/mouse/mouserelease/

Last Revision: 2019/02/21

実装の解析

まだ解析していません。

最終更新日

January 4, 2024

inserted by FC2 system