This example illustrates the use of the Mouse and keyboard libraries together. Five momentary switches act as directional buttons for your cursor. When a button is pressed, the cursor on your screen will move, and a keypress will be sent to the computer. Once you have the Leonardo programmed and wired up, open up your favorite text editor to see the results.
NB: When you use these libraries, the Arduino takes over your computer’s keyboard and mouse!
Software Required
- Any text editor
Circuit
image developed using Fritzing. For more circuit examples, see the Fritzing project page
Schematic
Read more: Arduino Keyboard and Mouse Control Code