Moving the cursor

Hi, is there a way of moving the cursor from a hardware level? like arduino that connects to the usb and controlls the cursor without the need of moving the cursor itself.

Thanks

Arduino uses Serial over USB and does not impliment true USB protocol such as HID. This means that it would require you to use a piece of software or some other hardware to impliment or pose as a USB HID.

/me

what do you mean by "other hardware"? a mouse?

what i thought really was to use the library of the ps2mouse and read the data of the mouse (though the arduino) and at the same time send it to the computer (to the usb or the ps2 outlet of the pc) and that will enable me to control the output of the mouse and modify it. what do you think? is it possible?

When you say "cursor" you mean "mouse pointer"?

This might help: Arduino mouse using AVRUSB.

--Phil.

yes i do mean mouse pointer.

the circuit looks nice. how does it know where to move the mouse pointer to?

I doesn't know where the mouse pointer is on the screen, all you can do is move a certain number of pixels left/right or up/down.

I can't remember off the top of my head but the example might only allow relative mouse movement. But at least in theory absolute movement should be possible to implement.

--Phil.

Edit: Consider watching this thread.

im trying to experiment with the ps2 mouse sketch (http://www.arduino.cc/playground/ComponentLib/Ps2mouse) but i didn't get why in the procedure of "gohi"

void gohi(int pin)
{
  pinMode(pin, INPUT);
  digitalWrite(pin, HIGH);
}

how come it sets the pin into INPUT and then gives it a HIGH reading? i thought you can give a pin a HIGH\LOW reading only of its set to OUTPUT, and if its in INPUT mode it can only use the digitalRead

bump

pinMode(pin, INPUT); digitalWrite(pin, HIGH);

That enables the internal pull-up resistor on the pin (thanx Mem for explaining that)

but why would you put it in INPUT mode? if the clock or the data pin has to be turned on, and give a high reading, it has to be on OUTPUT mode.

im trying to reverse the connection, i plugged a cut ps\2 cable and inserted the data and the clock wires into pins 13 and 12. im trying to do exactly the opposite of the program here:
http://www.arduino.cc/playground/ComponentLib/Ps2mouse

here is the original mouse_init() void from the program:

void mouse_init()
{
  gohi(MCLK);
  gohi(MDATA);
  //  Serial.print("Sending reset to mouse\n");
  mouse_write(0xff);
  Serial.println(mouse_read(),HEX);  /* ack byte */
  //  Serial.print("Read ack byte1\n");
  Serial.println(mouse_read(),HEX);  /* blank */
  Serial.println(mouse_read(),HEX); /* blank */
  //  Serial.print("Sending remote mode code\n");
  mouse_write(0xf0);  /* remote mode */
  mouse_read();  /* ack */
  //  Serial.print("Read ack byte2\n");
  delayMicroseconds(100);
}

and here is my reversed program:

void loop() 
{
    char data;
data=mouse_read();
Serial.println("Got data:");
Serial.println(data,HEX);
if (data=0xff)//the computer sent FF, he wants a response
  {
     mouse_write(0xfa);
     mouse_write(0xaa);
     mouse_write(0x0);
  }
}

at this point the computer truly sends FF, but it doesnt send the next code (or any code) which should be mouse_write(0xf0); and keeps sending FF, anyone knows where the problem is ?

if (data=0xff)

There's your problem. Just one equal sign which doesn't compare but instead simply assigns data the value of 0xff. The corrected code can be found below.

void loop()
{
    char data;
data=mouse_read();
Serial.println("Got data:");
Serial.println(data,HEX);
if (data==0xff) //the computer sent FF, he wants a response
  {
     mouse_write(0xfa);
     mouse_write(0xaa);
     mouse_write(0x0);
  }
}