1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Added MouseController class + example

This commit is contained in:
Cristian Maglie
2012-09-21 17:24:48 +02:00
parent 31719589b2
commit 3598ad6613
4 changed files with 210 additions and 0 deletions

View File

@ -0,0 +1,51 @@
// Require mouse control library
#include <MouseController.h>
// Initialize USB Controller
USBHost usb;
// Attach mouse controller to USB
MouseController mouse(usb);
// This function intercepts mouse movements
void mouseMoved() {
Serial1.print("Moving mouse: ");
Serial1.print(mouseX);
Serial1.print(", ");
Serial1.println(mouseY);
}
// This function intercepts mouse movements when a button is pressed
void mouseDragged() {
Serial1.print("DRAG: ");
Serial1.print(mouseX);
Serial1.print(", ");
Serial1.println(mouseY);
}
// This function intercepts mouse button press
void mousePressed() {
Serial1.print("Pressed: ");
Serial1.println(mouseButton);
}
// This function intercepts mouse button release
void mouseReleased() {
Serial1.print("Released: ");
Serial1.println(mouseButton);
}
void setup()
{
Serial1.begin(115200);
Serial1.println("Program started");
delay(200);
}
void loop()
{
// Process USB tasks
usb.Task();
}