So I'm relatively new to using arduino. In essence what I want to do is have the chip respond to the keyboard keys: w s a d and output the same signals as a joystick would. Any help would be greatly appreciated!
Any help would be greatly appreciated!
So would a link to the device you are trying to program.
In essence what I want to do is have the chip respond to the keyboard keys: w s a d and output the same signals as a joystick would.
Your Arduino has a keyboard attached?
The AD5206 is pretty simple to work with (I just happen to have some AD5204's on the desk in front of me), just send the right SPI codes - check it's data sheet.
A joystick just changes two resistances, one for the X and one for the Y axis. These should be 0-100K, so the AD5206-B100 should be perfect.
A PS2 keyboard can be read by the Arduino - check out the ps2 keyboard library on the Arduino Playground.
Then it's just a case of putting the two together. How you do that is up to you. You could have simple preset resistance values for each direction, or you could make it more analog and have the resistance change smoothly, so the longer you hold the button the further the joystick is "moved".
OK Thanks for the info. I guess I made a mistake in how I worded this. I want it to respond to keys pressed on my computer. (The reason for this is I have and xbox 360 controller connect my pc and I have program that maps it the computers.)
So you have a program on the PC which takes the input from the Xbox controller and makes it act like a keyboard?
so you press forwards and the W key gets pressed, and you let go and the W key gets released?
In that case you will need to write some software on the PC that takes these keypress and keyrelease events and converts them into serial instructions to send to the Arduino. You will have to make up a protocol for sending these instructions - it could be a simple one character sent with each character with a different meaning… Maybe send a “W” for “w pressed” and a “w” for “w released”, etc. Then the Arduino will need to interpret that protocol and set the resistances accordingly.