All Projects → per1234 → MouseTo

per1234 / MouseTo

Licence: MIT license
Arduino library for moving mouse pointer to absolute screen coordinates

Programming Languages

C++
36643 projects - #6 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to MouseTo

WiFiEspAT
Arduino networking library. Standard Arduino WiFi networking API over ESP8266 or ESP32 AT commands.
Stars: ✭ 178 (+278.72%)
Mutual labels:  arduino-library
Adafruit VL6180X
Arduino library for Adafruit VL6180X
Stars: ✭ 29 (-38.3%)
Mutual labels:  arduino-library
Effortless-SPIFFS
A class designed to make reading and storing data on the ESP8266 and ESP32 effortless
Stars: ✭ 27 (-42.55%)
Mutual labels:  arduino-library
sbus
Arduino and CMake library for communicating with SBUS receivers and servos.
Stars: ✭ 277 (+489.36%)
Mutual labels:  arduino-library
AD9850SPI
AD9850 SPI library for arduino
Stars: ✭ 20 (-57.45%)
Mutual labels:  arduino-library
Filters
An Arduino finite impulse response and infinite impulse response filter library.
Stars: ✭ 36 (-23.4%)
Mutual labels:  arduino-library
SparkFun AutoDriver Arduino Library
Arduino library support for the SparkFun AutoDriver board based on the ST Micro L6470 stepper driver.
Stars: ✭ 14 (-70.21%)
Mutual labels:  arduino-library
Arduino-Blinkenlight
Non-blocking blinking patterns and smooth fade effects for your LEDs.
Stars: ✭ 26 (-44.68%)
Mutual labels:  arduino-library
ZMPT101B-arduino
Arduino library for ZMPT101B voltage sensor.
Stars: ✭ 34 (-27.66%)
Mutual labels:  arduino-library
arduino-mcp23017
Complete support of MCP23017
Stars: ✭ 44 (-6.38%)
Mutual labels:  arduino-library
Adafruit MPL3115A2 Library
Arduino library for the MPL3115A2 sensors in the Adafruit shop
Stars: ✭ 41 (-12.77%)
Mutual labels:  arduino-library
Adafruit AMG88xx
AMG88xx Grid-EYE
Stars: ✭ 85 (+80.85%)
Mutual labels:  arduino-library
esp arduino sqlite3 lib
Sqlite3 library for ESP8266 Arduino core
Stars: ✭ 78 (+65.96%)
Mutual labels:  arduino-library
ArduBadge
ArduBadge gives you GitHub Badges for you Arduino Libraries. The badge shows the latest version available and custom installation instructions.
Stars: ✭ 24 (-48.94%)
Mutual labels:  arduino-library
arduino-google-maps-api
An Arduino library for communicating with the Google Maps Api
Stars: ✭ 42 (-10.64%)
Mutual labels:  arduino-library
Seeed Arduino Sketchbook
This library provides many Wio terminal demos and some other demo for seeed's product.
Stars: ✭ 64 (+36.17%)
Mutual labels:  arduino-library
esp-homekit-arduino-sdk
Arduino wrapper for ESP-IDF HomeKit library
Stars: ✭ 34 (-27.66%)
Mutual labels:  arduino-library
SparkFun Micro OLED Arduino Library
Arduino library for the SparkFun Micro OLED - a breakout board for a monochrome, 0.66", 64x48 OLED display.
Stars: ✭ 72 (+53.19%)
Mutual labels:  arduino-library
SevSeg
Seven Segment library for Arduino
Stars: ✭ 75 (+59.57%)
Mutual labels:  arduino-library
AndroidCar
Arduino library to control an Android Autonomous Vehicle by Team Pegasus
Stars: ✭ 41 (-12.77%)
Mutual labels:  arduino-library

MouseTo

Library for Arduino Leonardo/Micro/Pro Micro for moving the mouse pointer to absolute screen coordinates.

Table of contents

Installation

  • Download the most recent version of MouseTo here: https://github.com/per1234/MouseTo/archive/master.zip
  • Using Arduino IDE 1.0.x:
    • Sketch > Import Library... > Add Library... > select the downloaded file > Open
  • Using Arduino IDE 1.5+:
    • Sketch > Include Library > Add ZIP Library... > select the downloaded file > Open
  • Running the example sketches:
    • File > Examples > MouseTo
    • Upload to device

Usage

See the example sketches at File > Examples > MouseTo for demonstration of library usage.

#include <MouseTo.h>

Allow access to the functions of the MouseTo library.

MouseTo.setTarget(targetX, targetY[, homeFirst])

Move mouse pointer to absolute screen coordinates. Note that screen coordinates start from the upper left corner.

  • Parameter: targetX - X screen coordinate to move to.
    • Type: int
  • Parameter: targetY - Y screen coordinate to move to.
    • Type: int
  • Parameter(optional): homeFirst - Whether to home the mouse pointer before moving to the target. At a minimum the pointer must be homed before the first use of MouseTo in your code. If homing is not done after that time the accuracy of the mouse pointer movements might suffer, for example if the regular mouse connected to the computer is moved. The default value is true.
    • Type: boolean
  • Returns: none
MouseTo.getTargetX()

Get the last X coordinate set by MouseTo.setTarget().

  • Returns: Target X coordinate.
    • Type: int
MouseTo.getTargetY()

Get the last Y coordinate set by MouseTo.setTarget().

  • Returns: Target Y coordinate.
    • Type: int
MouseTo.move()

Move mouse pointer to the target coordinates. Multiple calls to MouseTo.move() may be required before the target coordinates are reached.

  • Returns: true = target coordinates reached, false = target coordinates not yet reached
    • Type: boolean
MouseTo.setScreenResolution(x, y)

When MouseTo.move() homes it assumes that the mouse pointer is at the lower right corner. The default values are set to home correctly even with very high resolution(4K UHD). By setting the MouseTo screen resolution value to your actual resolution you can reduce the time MouseTo.move() takes to reach the target coordinates.

  • Parameter: x - X screen resolution. The default value is 3840.
    • Type: int
  • Parameter: y - Y screen coordinate to move to. The default value is 2160.
    • Type: int
  • Returns: none
MouseTo.getScreenResolutionX()
  • Returns: X screen resolution.
    • Type: int
MouseTo.getScreenResolutionY()
  • Returns: Y screen resolution.
    • Type: int
MouseTo.setCorrectionFactor(correctionFactorInput)

The screen distance moved is different from the distance arguments passed to Mouse.move(). In order for MouseTo.move() coordinates to correspond with the screen coordinates you must set a correction factor. The correct value can be determined with File > Examples > MouseTo > BasicUsage.

  • Parameter: correctionFactorInput - The default value is 1(no correction).
    • Type: float
  • Returns: none
MouseTo.getCorrectionFactor()
  • Returns: Correction factor.
    • Type: float
MouseTo.setMaxJump(maxJumpDistanceInput)

Mouse.move() only allows a maximum move of 127 pixels in each axis so longer mouse pointer movements require multiple calls. Smaller values will require more calls to MouseTo.move() before the target coordinates are reached, larger values may lead to less accuracy. You must recalculate the correction factor whenever this is changed.

  • Parameter: maxJumpDistanceInput - The maximum distance(x and y) the mouse pointer can move on each call to MouseTo.move(). Allowable values are 1-127. The default value is 10.
    • Type: int8_t
  • Returns: none
MouseTo.getMaxJump()
  • Returns: Maximum jump distance.
    • Type: int8_t
MouseTo.home()

Re-home the mouse before continuing to the target coordinates. This is useful for cases when MouseTo.move() completion was delayed long enough that the mouse pointer may have been moved.

  • Returns: none

MouseTo.move() Process

  • Each call of MouseTo.move() moves the pointer up to the maximum jump distance(set by MouseTo.setMaxJump()) in the x and y axes.
  • Home mouse pointer to (0, 0).
  • Once the mouse pointer is homed start moving to the target coordinates.
  • Once the target coordinates are reached return true.

Mouse coordinate display software

For calibration and usage, it is helpful to have a program that displays the current mouse pointer coordinates. Here are some options:

  • MousePosition.html (any OS): This file is included with the library in the extras folder. Open it with your browser and the mouse coordinates will be displayed there. It will work on any OS. It only works when the mouse pointer is over the browser window. You can set the browser to full screen, move the mouse to the desired position in another window, then use the keyboard to switch back to the browser window (e.g. Alt+Tab) to check the coordinates.
  • MousePointer console application (Windows OS): This program displays the coordinates even when the mouse pointer is not over the application window.
  • watch -t -n 0.01 xdotool getmouselocation (Linux or macOS) - Install xdotool and then run this command from the terminal. The decimal point in 0.01 is locale-dependent so you may need to change it to 0,01.
  • Android developer tools (Android) - Android has a built-in option to display the pointer coordinates. When using this for calibration, note that it only displays the coordinates while a mouse button is pressed, so you will need to use Mouse.press() in your code for this purpose.
    • Settings > Developer options
    • Set Developer options to on.
    • Set Pointer location to on.

Alternatives

Contributing

Pull requests or issue reports are welcome! Please see the contribution rules for instructions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].