getYChange()

描述

回覆滑鼠從上一次查詢後在 Y 軸上移動的距離,回傳的值如果是正的,表示往下移動,反之則表示往上移動。

語法


mouse.getYChange()

參數

無參數

回傳

int

範例

#include <MouseController.h>

// 初始化 usb 物件
USBHost usb;

// 連接滑鼠到 usb 物件
MouseController mouse(usb);

void mouseMoved() {
  Serial.print("Move: ");
  Serial.print(mouse.getXChange());
  Serial.print(", ");
  Serial.println(mouse.getYChange());
}

void setup(){
  Serial.begin(9600);
}

void loop(){
  usb.Task();
}

參見

mouseDragged()
mousePressed()


函式庫參考主頁面

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.