Simulating a mouse or keyboard

i would like my arduino to act like a mouse or keyboard to send inputs like right click or enter to the computer. This is so that when the computer sleeps, i do not need to rely on touching a real keyboard or mouse to get the computer to wake up.

i tried looking around and i found it at the bottom of the following url, emulating a ps2 device. Arduino Playground - Ps2mouse

but apparently it doesnt seem to compile. i get the following errors

c:/documents and settings/window xp/desktop/arduinotest/arduino-0018/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected unqualified-id before 'int'

c:/documents and settings/window xp/desktop/arduinotest/arduino-0018/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected `)' before 'int'

c:/documents and settings/window xp/desktop/arduinotest/arduino-0018/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected `)' before 'int'

Bad error line: -3

thx for reading. is there other alternatives i can turn to?

look into Processing. You can give mouseX and mouseY coords, I think you can also emulate key presses. look here Reference / Processing.org

On windows computers there should be an option to have the computer not to go into a sleep mode. I looked in my notebook power settings and there is an "always on" option.

thx for the replies. i cant seem to emulate the key presses using processing. i did something like

void draw() {
  mouseX += 1;
  mouseY += 1;
}

The sleeping part of the computer is mandatory if it lies idle for a long time, i would like the sleep mode to be enabled. thanks.

mouseX and mouseY are variables for telling where the mouse is located. It doesn't change the position of the mouse.

Use "AAC Keys" for mouse/keyboard commands from a serial device. I've tried it and it works great. Search for that here and you should find it. That's definitely what you want if you wish to control a mouse or keyboard from the Arduino.

Why can't you change your computer's settings, though?

Kyle

im not sure how it really works for AAC KEYS. is using the usb serial port for sending information to the computer useable?

oh no, i have a problem. Because im communicating with processing which uses the serial port, im afraid it clashes with the AACKeys port reading. is there anyway i can resolve this?

Oh, that's a good point. No clue, to be honest. I just used AAC Keys without processing, but I do recall trying to access the serial monitor, and it denied access to me.

Kyle