looks - to me(!) - if there is an irreguality in the ps2 lib. Send a request to the forum and got one helpful hint for a workaround. looking forward for a reply of the author of the lib Jonathan Laloz but he didn't respond to the forum. Now I like to contact him directly how can I reach him? The "contact button on the potter project web page is dead
The issue: mouse movement in the 1st quadrant didn't generate aprobiate status change also pressing the middle mouse button
The example code from the lib, slightly modified:
#include <ps2.h>
/*
* an arduino sketch to interface with a ps/2 mouse.
* Also uses serial protocol to talk back to the host
* and report what it finds.
*/
/*
* Pin 2 is the mouse data pin --green
/* pin 3 is the clock pin --white
* Feel free to use whatever pins are convenient.
*/
PS2Mouse mouse(3, 2);
int old_mouseStatus=0; //for change tracking
void setup()
{
Serial.begin(9600);
mouse.init();
}
/*
* get a reading from the mouse and report it back to the
* host via the serial line.
*/
void loop()
{
MouseInfo mouseInfo;
mouse.getData(&mouseInfo);
if (mouseInfo.status!=8){ //print if status has changed
// old_mouseStatus=mouseInfo.status; //save new status
Serial.print(mouseInfo.status, BIN);
//X change
Serial.print("\tX=");
Serial.print(mouseInfo.x, DEC);
//Y change
Serial.print("\tY=");
Serial.print(mouseInfo.y, DEC);
//Scroll change
Serial.print("\tSc=");
Serial.print(mouseInfo.scroll, DEC);
//Left button down
Serial.print("\tLB=");
Serial.print(mouseInfo.leftClick, DEC);
//Middle button down
Serial.print("\tMB=");
Serial.print(mouseInfo.middleClick, DEC);
//Right button down
Serial.print("\tRB=");
Serial.print(mouseInfo.rightClick, DEC);
//Cumulative X position
Serial.print("\tCX=");
Serial.print(mouseInfo.cX, DEC);
//Cumulatie Y position
Serial.print("\tCY=");
Serial.print(mouseInfo.cY, DEC);
//Cumulative scroll postion
Serial.print("\tCS=");
Serial.print(mouseInfo.cScroll, DEC);
Serial.println();
// delay(1000); //no delay change tracking surpresses continius update
}
}