Tutorial.ButtonMouseControl History

Using the Mouse library, you can controls a computer's onscreen cursor with an Arduino Leonardo. This particular example uses a five pushbuttons to move the onscreen cursor. Four of the buttons are directional (up, down, left, right) and one is for a left mouse click

Cursor movement from the Leonardo is always relative. So every time an input is read, the cursor's position is updated relative to it's current position.

Whenever one of the directional buttons is pressed, the Leonardo will move the mouse, mapping a HIGH input to a range of 5 in the appropriate direction.

The fifth button is for controlling a left click from a mouse. When pressed, the Leonardo sends a press to the computer. When the button is released, the computer will recognize the event.

to:

Using the Mouse library, you can controls a computer's onscreen cursor with an Arduino Leonardo, Micro, or Due. This particular example uses a five pushbuttons to move the onscreen cursor. Four of the buttons are directional (up, down, left, right) and one is for a left mouse click

Cursor movement from the Arduino is always relative. Every time an input is read, the cursor's position is updated relative to it's current position.

Whenever one of the directional buttons is pressed, the Arduino will move the mouse, mapping a HIGH input to a range of 5 in the appropriate direction.

The fifth button is for controlling a left click from a mouse. When pressed, the board sends a press to the computer. When the button is released, the computer will recognize the event.

Changed line 16 from:

Arduino Leonardo board

to:

Arduino Leonardo, Micr or Due board

Changed lines 29-30 from:

Connect your Leonardo board to your computer with a micro-USB cable. The buttons are connected to digital inputs 2-6. Make sure you use pulldown resistors.

to:

Connect your board to your computer with a micro-USB cable. The buttons are connected to digital inputs 2-6. Make sure you use pulldown resistors.

NB: When you use the Mouse.move() command, the Arduino takes over your computer's cursor! To insure you don't lose control of your computer while running a sketch with this function, make sure to set up a controller before you call Mouse.move(). This sketch includes a pushbutton to toggle the mouse control state, so you can turn on and off mouse control.

to:

NB: When you use the Mouse.move() command, the Arduino takes over your computer's cursor! To insure you don't lose control of your computer while running a sketch with this function, make sure to set up a controller before you call Mouse.move(). This sketch only updates the cursor position when a button is pressed.