Introduction: April Fools - Mouse Joke

This gag uses the mouse functionality of an Arduino Leonardo to move the cursor of an unsuspecting friend or colleague.

The Arduino in my photo is a MakeyMake but any Leonardo should work.

Step 1: Upload Code

Using the Arduino IDE upload the attached sketch.

or copy and paste the code below.

You will see some variables at the top of the sketch for randomizing the gag.

This will have the mouse move in random sized circles at random intervals.


int minimum_radius = 10;
int maximum_radius = 30;
float angle = 0.0;
int x, y;
int delay_minimum = 2;  // minimum pause between circles (in seconds)
int delay_maximum = 60; // maximum pause between circles (in seconds)

void setup() {

void loop() {

    int diameter = random(minimum_radius,maximum_radius); // random diameter of the circle
    int pause = random(delay_minimum, delay_maximum); // random pause

     while (angle < 2 * PI)  // calculate and move the mouse in a circle

        x = diameter * cos (angle);
        y = diameter * sin (angle);
        angle += .2; // increment the angle
       Mouse.move(x, y, 0);

       angle = 0; // reset the angle ready for another circle
       delay(pause * 1000); // pause for some time to add more confusion


Step 2: Hide the Prank

Next, simply find a box or a book or some way to hide the Arduino, run the cable to a USB port on the victim's computer and sit back and watch the fun.

This work especially well on messy desks where you can easily hide the Arduino and cable.

Even better is the victim has a tower computer and you can plug this in behind without the need to hide it.

Step 3:

Here is a screen shot of my screen while the Arduino is plugged in.

I think that having longer delays in between each circle will work better as an April Fool.

If the mouse only moves ever 10 minutes or so, the victim will try and show people what is happening but the issue won't happen immediately.

I know who my first victim is going to be and I think it will drive him crazy.

April Fool's Contest

Participated in the
April Fool's Contest