# April Fools - Mouse Joke

2,453

6

2

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

http://arduino.cc/en/Main/ArduinoBoardLeonardo

http://arduino.cc/en/Reference/MouseKeyboard

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

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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.

---------------------------------------------------------

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() {
Mouse.begin();
}

void loop() {

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);
delay(20);
}

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.

Participated in the
April Fool's Contest

## Recommendations

• ### Internet of Things Class

22,855 Enrolled

## 2 Discussions

I'd love to see video of your victim! This sounds like it would be fun to watch.

Not exactly sure how to rig it bug it looks awesome.

Anyone ever took a tube and ran it out of the computer room down the hall or something and took the other side and put it up on the computer desk inside a big jar of shredded paper that you cut up. Then blow and it disperses the paper all over the desk like confetti. Evil prank!