File tree 1 file changed +3
-3
lines changed
build/shared/examples/09. USB (Leonardo only)/Mouse/JoystickMouseControl 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 21
21
you can turn on and off mouse control.
22
22
23
23
created 15 Sept 2011
24
- updated 27 Mar 2012
24
+ updated 28 Mar 2012
25
25
by Tom Igoe
26
26
27
27
this code is in the public domain
@@ -47,6 +47,8 @@ int lastSwitchState = LOW; // previous switch state
47
47
void setup () {
48
48
pinMode (switchPin, INPUT); // the switch pin
49
49
pinMode (ledPin, OUTPUT); // the LED pin
50
+ // take control of the mouse:
51
+ Mouse.begin ();
50
52
}
51
53
52
54
void loop () {
@@ -67,8 +69,6 @@ void loop() {
67
69
int xReading = readAxis (A0);
68
70
int yReading = readAxis (A1);
69
71
70
- // take control of the mouse:
71
- Mouse.begin ();
72
72
// if the mouse control state is active, move the mouse:
73
73
if (mouseIsActive) {
74
74
Mouse.move (xReading, yReading, 0 );
You can’t perform that action at this time.
0 commit comments