mouseReleased() is a function that is called whenever a button on a connected USB mouse is released.
void mouseReleased(){
//statements
}
#include <MouseController.h>
// Initialize USB Controller
USBHost usb;
// Attach mouse controller to USB
MouseController mouse(usb);
boolean left = false;
boolean middle = false;
boolean right = false;
void mousePressed() {
if (mouse.getButton(LEFT_BUTTON))
left = true;
if (mouse.getButton(MIDDLE_BUTTON))
middle = true;
if (mouse.getButton(RIGHT_BUTTON))
right = true;
}
// This function intercepts mouse button release
void mouseReleased() {
Serial.print("Released: ");
if (!mouse.getButton(LEFT_BUTTON) && left==true) {
Serial.print("L");
left = false;
}
if (!mouse.getButton(MIDDLE_BUTTON) && middle==true) {
Serial.print("M");
middle = false;
}
if (!mouse.getButton(RIGHT_BUTTON) && right==true) {
Serial.print("R");
right = false;
}
Serial.println();
}
void setup(){
Serial.begin(9600);
}
void loop(){
usb.Task();
}