#include <Mouse.h>
void setup() {
// put your setup code here, to run once:
Mouse.begin();
Mouse.click(MOUSE_RIGHT);
}
void loop() {
// put your main code here, to run repeatedly:
}
**update:
when i upload this, nothing happens, ardino IDE stuck 'uploading...'
I've only used mouse functions with Esplora, which is slightly different from Leonardo.
I'm not sure about the use of #include <mouse.h>
How will you know if the mouse has clicked or not?
As you have shown it, it only executes once because you've placed that command in setup ( ).
I wonder if the Esplora examples in the IDE will work with Leonardo (if you just remove their #include <esplora.h> ) ?
http://cal-eng.com/?page_id=579
vs.
http://arduino.cn/reference/MouseKeyboard.html
Required with Arduino IDE 1.6.6 and later, causes compile error with previous IDE versions.
The File > Examples > 09.USB > Mouse examples should provide enough to get started.