From 5cac4a358f7eec662a3916f0da5c596452079a87 Mon Sep 17 00:00:00 2001 From: llooo7 Date: Fri, 4 Feb 2022 20:35:04 +0100 Subject: [PATCH] Update Space_Mouse.ino --- Space_Mouse/Space_Mouse.ino | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Space_Mouse/Space_Mouse.ino b/Space_Mouse/Space_Mouse.ino index b2d38ca..952581c 100644 --- a/Space_Mouse/Space_Mouse.ino +++ b/Space_Mouse/Space_Mouse.ino @@ -12,13 +12,13 @@ struct Joystick { Joystick joy = {15, A3, A2, A1, A0}; // VCC is throwaway, it's connected directly to VCC PIN -const int calibration = 50; // adjust speed, lower value means faster movement +const int calibration = 100; // adjust speed, lower value means faster movement #define THRESHOLD 1 int yOffset, xOffset; int yValue, xValue; bool swState, swStatePrev = HIGH; int mode = 0; -int numModes = 4; +int numModes = 1; Joystick_ Joystick; @@ -122,6 +122,7 @@ void loop() { if (xValue > THRESHOLD || xValue < -THRESHOLD) { if(mode < 2) { if(mode == 0) Keyboard.press(KEY_LEFT_SHIFT); + delay(5); Mouse.press(MOUSE_MIDDLE); Mouse.move(xValue/calibration, 0, 0); } @@ -141,6 +142,7 @@ void loop() { if (yValue > THRESHOLD || yValue < -THRESHOLD) { if(mode < 2) { if(mode == 0) Keyboard.press(KEY_LEFT_SHIFT); + delay(5); Mouse.press(MOUSE_MIDDLE); Mouse.move(0, yValue/calibration, 0); }