Hi, I am developing a script for the mouse cursor control: I have to make the absolute movement of the cursor on the screen in a very precise position, starting from any position on the screen. I wrote this:
#include <MouseTo.h>
#include <Mouse.h>
int stato;
int button = 2;
void setup(){
pinMode(4, INPUT);
pinMode(button,OUTPUT);
}
void loop(){
stato=digitalRead(4);
int x;
int y;
if(stato== HIGH){
Mouse.begin();
digitalWrite(button,HIGH);
for(int z = 1; z <= 10; z++){
x = random(0, 10);
y = random(0, 10);
MouseTo.setTarget(x,y, true);}
delay(1000);
} else {
digitalWrite(button,LOW);
Mouse.press();
}
Mouse.end();
}
The cursor doesn't move and I can't control it with the button on the breadboard
if absolute positioning is not available. Move into one edge of the screen 5000 pixels long
Then the mouse-arrow will be surely in the edge and then you can move again relative for a certain amout of steps and be sure that it is an absolute position
best regards Stefan