Spam mouse clicks

Dependencies:   USBDevice mbed

main.cpp

Committer:
Palantir
Date:
2014-02-28
Revision:
0:32f77a353ea8

File content as of revision 0:32f77a353ea8:

#include "mbed.h"
#include "USBMouse.h" //The library to work as a mouse

USBMouse mouse; //Declare the object mouse
DigitalIn myInput(p5); //Set an input to control when to send clicks

int main() {
    myInput.mode(PullDown); //Internal pull-down resistor in the input pin
    while (1) { //Forever:
        if(myInput.read()==1) //If the input button/switch is enabled
            mouse.click(MOUSE_LEFT); //click
    }
}