You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/built-in-examples/09.usb/JoystickMouseControl/JoystickMouseControl.md
+6-14Lines changed: 6 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -9,28 +9,25 @@ tags:
9
9
- Joystick
10
10
---
11
11
12
-
Using the Mouse library, you can controls a computer's onscreen cursor with an Arduino Leonardo, Micro, or Due. This particular example uses a pushbutton to turn on and off mouse control with a joystick.
12
+
Using the Mouse library, you can control a computer's onscreen cursor with an Arduino Leonardo, Micro, or Due. This particular example uses a pushbutton to turn on and off mouse control with a joystick.
13
13
14
-
Cursor movement from the Arduino is always relative. So every time the analog input is read, the cursor's position is updated relative to it's current position.
14
+
Cursor movement from the Arduino is always relative. So every time the analog input is read, the cursor's position is updated relative to its current position.
15
15
16
-
Two analog inputs ranging from 0 to 1023 are translated to ranges of -12 to 12. The sketch assumes that the joystick resting values are around the middle of the range, but that they vary within a threshold.
16
+
Two analog inputs ranging from 0 to 1023 are translated to ranges of -12 to 12. The sketch assumes that the joystick resting values are around the middle of the range, but that they vary within a threshold.
17
17
18
18
The pushbutton allows you to toggle mouse control on and off. As an option you may connect a status LED to pin 5 that lights upwhen the Arduino is controlling the mouse. A second pushbutton may be connected with another 10k ohm pulldown (to GND) resistor to D3 to act as the left click of the mouse.
19
19
20
-
**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.**
20
+
***Note: If you want to add the LED or the extra pushbutton, please follow the guidelines for the [LED circuit](../basics/Blink) and the [button circuit](../digital/Button).***
21
+
22
+
***Note: 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.***
21
23
22
24
### Hardware Required
23
25
24
26
- Arduino Leonardo, Micro, or Due board
25
-
26
27
- 2 axis joystick
27
-
28
28
- momentary pushbutton (possibly integrated in the joystick)
29
-
30
29
- LED
31
-
32
30
- 220 ohm resistor
33
-
34
31
- 10k ohm resistor (if needed as pulldown)
35
32
36
33
### Circuit
@@ -39,13 +36,10 @@ Connect your Leonardo board to your computer with a micro-USB cable. The pushbut
0 commit comments