mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Moved begin() in JoystickMouseControl example.
This commit is contained in:
@ -21,7 +21,7 @@
|
|||||||
you can turn on and off mouse control.
|
you can turn on and off mouse control.
|
||||||
|
|
||||||
created 15 Sept 2011
|
created 15 Sept 2011
|
||||||
updated 27 Mar 2012
|
updated 28 Mar 2012
|
||||||
by Tom Igoe
|
by Tom Igoe
|
||||||
|
|
||||||
this code is in the public domain
|
this code is in the public domain
|
||||||
@ -47,6 +47,8 @@ int lastSwitchState = LOW; // previous switch state
|
|||||||
void setup() {
|
void setup() {
|
||||||
pinMode(switchPin, INPUT); // the switch pin
|
pinMode(switchPin, INPUT); // the switch pin
|
||||||
pinMode(ledPin, OUTPUT); // the LED pin
|
pinMode(ledPin, OUTPUT); // the LED pin
|
||||||
|
// take control of the mouse:
|
||||||
|
Mouse.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
@ -67,8 +69,6 @@ void loop() {
|
|||||||
int xReading = readAxis(A0);
|
int xReading = readAxis(A0);
|
||||||
int yReading = readAxis(A1);
|
int yReading = readAxis(A1);
|
||||||
|
|
||||||
// take control of the mouse:
|
|
||||||
Mouse.begin();
|
|
||||||
// if the mouse control state is active, move the mouse:
|
// if the mouse control state is active, move the mouse:
|
||||||
if (mouseIsActive) {
|
if (mouseIsActive) {
|
||||||
Mouse.move(xReading, yReading, 0);
|
Mouse.move(xReading, yReading, 0);
|
||||||
|
Reference in New Issue
Block a user