Skip to content

Commit 57b3395

Browse files
author
Tom Igoe
committed
Moved begin() in JoystickMouseControl example.
1 parent f4746a6 commit 57b3395

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

build/shared/examples/09. USB (Leonardo only)/Mouse/JoystickMouseControl/JoystickMouseControl.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
you can turn on and off mouse control.
2222
2323
created 15 Sept 2011
24-
updated 27 Mar 2012
24+
updated 28 Mar 2012
2525
by Tom Igoe
2626
2727
this code is in the public domain
@@ -47,6 +47,8 @@ int lastSwitchState = LOW; // previous switch state
4747
void setup() {
4848
pinMode(switchPin, INPUT); // the switch pin
4949
pinMode(ledPin, OUTPUT); // the LED pin
50+
// take control of the mouse:
51+
Mouse.begin();
5052
}
5153

5254
void loop() {
@@ -67,8 +69,6 @@ void loop() {
6769
int xReading = readAxis(A0);
6870
int yReading = readAxis(A1);
6971

70-
// take control of the mouse:
71-
Mouse.begin();
7272
// if the mouse control state is active, move the mouse:
7373
if (mouseIsActive) {
7474
Mouse.move(xReading, yReading, 0);

0 commit comments

Comments
 (0)