mirror of
https://github.com/esp8266/Arduino.git
synced 2025-08-05 13:16:13 +03:00
Update to Esplora example
Added Mouse.press to Esplora Joystick Mouse example
This commit is contained in:
@@ -17,6 +17,10 @@
|
||||
|
||||
Created on 22 Dec 2012
|
||||
by Tom Igoe
|
||||
Updated 8 March 2014
|
||||
by Scott Fitzgerald
|
||||
|
||||
http://arduino.cc/en/Reference/EsploraReadJoystickSwitch
|
||||
|
||||
This example is in the public domain.
|
||||
*/
|
||||
@@ -45,6 +49,12 @@ void loop()
|
||||
int mouseY = map(yValue, -512, 512, -10, 10); // map the Y value to a range of movement for the mouse Y
|
||||
Mouse.move(mouseX, mouseY, 0); // move the mouse
|
||||
|
||||
if (button == 0) { // if the joystick button is pressed
|
||||
Mouse.press(); // send a mouse click
|
||||
} else {
|
||||
Mouse.release(); // if it's not pressed, release the mouse button
|
||||
}
|
||||
|
||||
delay(10); // a short delay before moving again
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user