Created
July 2, 2023 21:16
-
-
Save sowbug/27e6dc598d92328952070e08eac5287f to your computer and use it in GitHub Desktop.
USB mouse wiggler for Arduinos that can emulate USB devices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Mouse.h" | |
void setup() { | |
Mouse.begin(); | |
// Give it a sec to initialise, or we miss the first jiggle when it's plugged in | |
delay(5000); | |
} | |
int shift = 5; | |
int instdelay = 50; | |
int jiggledelay = 30000; | |
void loop() { | |
// Clockwise circle | |
Mouse.move(shift, -shift, 0); | |
delay(instdelay); | |
Mouse.move(shift, shift, 0); | |
delay(instdelay); | |
Mouse.move(-shift, shift, 0); | |
delay(instdelay); | |
Mouse.move(-shift, -shift, 0); | |
delay(instdelay); | |
// Counter-clockwise circle | |
Mouse.move(-shift, -shift, 0); | |
delay(instdelay); | |
Mouse.move(-shift, shift, 0); | |
delay(instdelay); | |
Mouse.move(shift, shift, 0); | |
delay(instdelay); | |
Mouse.move(shift, -shift, 0); | |
delay(instdelay); | |
// And thus we have a figure 8, back at the starting place. | |
delay(jiggledelay); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment