controlling arduino with a keyboard and mouse

Hello i'm new at the arduino but i want to control my arduino with my keyboard and mouse.

this to drive a arduino controlled bot. can anyone provide links on how to or help me get started on some code.

i couldn't find a post about it so i started a new one if it already exists please redirect me

thanks blackhydra

The Arduino can nor read hardware on the PC that it is attached to. So, reading the mouse position or key presses is not going to be possible.

An application running on the PC could, though, and then send that information to the serial port, in a format that the Arduino can understand.

How you go about writing such an application depends on your programming skills, tools that you have available, and the operating system on the PC. Seems you neglected to mention any of these factors.

http://processing.org/ provides a free language/IDE that can read mouse and keyboard events, and send them to the serial port, in an OS independent manner, if you wanted to install there application. Plenty of examples come with the software, just like with the Arduino. The interfaces are similar, too.

or if you meant the opposite, and just plugging in a keyboard or mouse into the arduino, you can use ps/2 style accessories pretty easily (and there are already libraries in the playground)

at paulS thanks for the info.

i'm running windows XP 64bit. i'm new at programming and the only computer languages i know are html and lua. But i'm a fast learner so i hope i get it right. i'm gonna read the page you gave and try too get the hang of the program.

thanks

@Osgeld i want too use my pc too drive the arduino but thanks anyway :)

Probably the simplest thing to do is make web page GUI for mouse click controls, Put the apache web server on your computer, and have apache to run a simple batch file to send the aduino web page command to the computer serial port.

you could use lua if you wanted to, it would be kludged since lua does not directly support serial communication

but it does support the ability to run command line commands, so you could redirect the output of a cmd print command to whatever serial port your arduino is connected to

here is the "idea", in windows there is a command line holdover from dos, print, which lets you read a (hopefully) text file and dump it to your printer, by default this data is going to be sent to the first printer port, you need to change that to send it to a com port (the one your arduino shows up on)

you can read up on that here but it more or less boils down to banging something like this

MODE COM1:96,N,8,1,P
MODE LPT1=COM1

then, while being updated in the loop c:\>print output.txt to dump the contents of the file specified to the now serial port

on the lua side of things, you will have to manage a file (since the print command outputs a file) along with command line output and whatever interface you manage to tie in, the last one being the only hard part

http://www.ac-web.org/forums/showthread.php?t=71015

http://www.lua.org/manual/5.1/manual.html#pdf-os.execute

ps: look into processing

http://processing.org/

i’m gonna look at the processing program but thanks for all the help i’ll let you know if i got it working :slight_smile:

There's also a library for the arduino to directly communicate with a PS/2 keyboard.