Spam mouse clicks

Dependencies:   USBDevice mbed

Committer:
Palantir
Date:
Fri Feb 28 09:45:35 2014 +0000
Revision:
0:32f77a353ea8
First commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Palantir 0:32f77a353ea8 1 #include "mbed.h"
Palantir 0:32f77a353ea8 2 #include "USBMouse.h" //The library to work as a mouse
Palantir 0:32f77a353ea8 3
Palantir 0:32f77a353ea8 4 USBMouse mouse; //Declare the object mouse
Palantir 0:32f77a353ea8 5 DigitalIn myInput(p5); //Set an input to control when to send clicks
Palantir 0:32f77a353ea8 6
Palantir 0:32f77a353ea8 7 int main() {
Palantir 0:32f77a353ea8 8 myInput.mode(PullDown); //Internal pull-down resistor in the input pin
Palantir 0:32f77a353ea8 9 while (1) { //Forever:
Palantir 0:32f77a353ea8 10 if(myInput.read()==1) //If the input button/switch is enabled
Palantir 0:32f77a353ea8 11 mouse.click(MOUSE_LEFT); //click
Palantir 0:32f77a353ea8 12 }
Palantir 0:32f77a353ea8 13 }