Arduino Mouse Mover

less than 1 minute read

I have a friend who is working from home. This friend has a manager who’s way of measuring people’s productivity is ensuring said people are active on Slack. My friend staretd limiting themselves from taking lunch breaks, which is not ideal. Something had do be done to keep the manager happy while my friend is away from their computer.

I thought about running some sort of sofrware that moves the mouse every couple of seconds, but since the computer is managed I didn’t want to run anything suspicious on it. Instead, I grabbed a spare Arduion-Leonardo-compatible board I had. Those things are tiny and can identify as an HID (human input device) via their USB connection. I programmed it to move the mouse a tiny bit every second. It was very easy and works great.

The code

#include <Mouse.h>

void setup() {
  // put your setup code here, to run once:
  Mouse.begin();
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(1000);
  Mouse.move(1, 0, 0);
  delay(1000);
  Mouse.move(-1, 0, 0);
}