I am trying to have my teensy emulate a mouse, but I am failing. I cannot get it to move the cursor. I have tried using the code from https://www.pjrc.com/teensy/td_mouse.html however, it still does not work. I am using a teensy 3.2 and I am trying to emulate a mouse on a mac. To find my cursor position I use command+shift+4 (also I have defined the variables openapp later in my code). I am trying to move the mouse to 452, 226 and later 457, 192. Any advice?
Code:
#include <Bounce.h>
int led = 13;
int ds = 500;
Bounce button4 = Bounce(4, 10);
Bounce button5 = Bounce(5, 10);
void setup() {
Mouse.screenSize(1920, 1080, true);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(led, OUTPUT);
button4.update();
button5.update();
delay(1000);
openapp("System Preferences");
delay(ds);
openapp("Terminal");
cmd(KEY_N);
typeln("osascript -e 'tell application \"System Events\" to set bounds of window \"System Preferences\" of application \"System Preferences\" to {0, 0, 700, 700}'");
cmd(KEY_TAB);
cmd(KEY_F);
typeln("Wi-Fi");
k(KEY_ENTER);
delay(ds);
//moving to network name selection
if (button4.fallingEdge()) {
Mouse.moveTo(452, 226); //doesn't work
}