interfacing mouse with arduino and controlling servos

hey i am working on a project where i need to control two servos using a ps/2 mouse... i dont know how to incorporate the Scroll function of a mouse in code... i use the mouse.read() function from the ps/2 library and store it in "char mstat" variable...the initial value of mstat in decimal is 8...the value changes when button are pressed but nothing happens when the scroller is used...can anyone please help me with the code??
the code i am using is:

#include <ps2.h>
#include <Servo.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 5 is the mouse data pin, pin 6 is the clock pin
 * Feel free to use whatever pins are convenient.
 */
PS2 mouse(6, 5);

Servo servoX;
Servo servoY;

/*
 * initialize the mouse. Reset it, and place it into remote
 * mode, so we can get the encoder data on demand.
 */
void mouse_init()
{
  mouse.write(0xff);  // reset
  mouse.read();  // ack byte
  mouse.read();  // blank */
  mouse.read();  // blank */
  mouse.write(0xf0);  // remote mode
  mouse.read();  // ack
  delayMicroseconds(100);
}

void setup()
{
  Serial.begin(9600);
  mouse_init();
  servoX.attach(9);
  servoY.attach(10);
}

int xGlobal = 0;
int yGlobal = 0;
/*
 * get a reading from the mouse and report it back to the
 * host via the serial line.
 */
void loop()
{

   char mstat;
  char mx;
  char my;

  /* get a reading from the mouse */
  mouse.write(0xeb);  // give me data!
  mouse.read();      // ignore ack
  mstat = mouse.read();
  mx = mouse.read();
  my = mouse.read();

  xGlobal = xGlobal + mx;
  yGlobal = yGlobal + my;

  int valX = map(xGlobal, 50, -50, 0, 179);
  servoX.write(valX/4);
 //   Serial.print(valX);
    //delay(10);
  int valY = map(yGlobal, 50, -50, 60, 179);
  servoY.write(valY/4);
  //
//  Serial.print(valY);
 //  delay(10);
 //Serial.println(valX);
 //Serial.println(valY);

  /* send the data back up */
  Serial.print(mstat, DEC);
  Serial.print("\tX=");

 // Serial.print(xGlobal);
  Serial.print(xGlobal, DEC);
  Serial.print("\tY=");
  //Serial.print(yGlobal);

  Serial.print(yGlobal, DEC);
  Serial.println();
 //  delay(20);  /* twiddle */


 }

The output on the serial monitor is
8 x=0 y=0

Moderator edit: Code tags.

I don't think that library supports the PS/2 extensions needed to read the scroll wheel. See 'Intellimouse Extensions' at http://www.computer-engineering.org/ps2mouse/.

so which library should i use??

I don't know. Possibly none of them support Intellimouse Extensions.

hey i am working on a project where i need to control two servos using a ps/2 mouse... i dont know how to incorporate the Scroll function of a mouse in code... i use the mouse.read() function from the ps/2 library and store it in "char mstat" variable...the initial value of mstat in decimal is 8...the value changes when button are pressed but nothing happens when the scroller is used...can anyone please help me with the code??
the code i am using is:

Code:
#include <ps2.h>
#include <Servo.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 5 is the mouse data pin, pin 6 is the clock pin
  • Feel free to use whatever pins are convenient.
    */
    PS2 mouse(6, 5);

Servo servoX;
Servo servoY;

/*

  • initialize the mouse. Reset it, and place it into remote
  • mode, so we can get the encoder data on demand.
    */
    void mouse_init()
    {
    mouse.write(0xff); // reset
    mouse.read(); // ack byte
    mouse.read(); // blank */
    mouse.read(); // blank */
    mouse.write(0xf0); // remote mode
    mouse.read(); // ack
    delayMicroseconds(100);
    }

void setup()
{
Serial.begin(9600);
mouse_init();
servoX.attach(9);
servoY.attach(10);
}

int xGlobal = 0;
int yGlobal = 0;
/*

  • get a reading from the mouse and report it back to the
  • host via the serial line.
    */
    void loop()
    {

char mstat;
char mx;
char my;

/* get a reading from the mouse */
mouse.write(0xeb); // give me data!
mouse.read(); // ignore ack
mstat = mouse.read();
mx = mouse.read();
my = mouse.read();

xGlobal = xGlobal + mx;
yGlobal = yGlobal + my;

int valX = map(xGlobal, 50, -50, 0, 179);
servoX.write(valX);
// Serial.print(valX);
//delay(10);
int valY = map(yGlobal, 50, -50, 60, 179);
servoY.write(valY);
//
// Serial.print(valY);
// delay(10);
//Serial.println(valX);
//Serial.println(valY);

/* send the data back up */
Serial.print(mstat, DEC);
Serial.print("\tX=");

// Serial.print(xGlobal);
Serial.print(xGlobal, DEC);
Serial.print("\tY=");
//Serial.print(yGlobal);

Serial.print(yGlobal, DEC);
Serial.println();
// delay(20); /* twiddle */

}

The output on the serial monitor is
8 x=0 y=0

Try writing the 'Get Device ID' command to the mouse. See what you get back. If you get 0x03 back, try reading four bytes after the 'Get Data' command.

OP: Three small reminders:

  1. DO NOT CROSS-POST - it wastes time

  2. When posting code, please use code tags

  3. DO NOT CROSS-POST.

how do i know what im getting back?? i put the get device id command
mouse.write(0xF5);

sorry sorry!