this code provides the keyboard controlling power for various 3d games .. here it has been done for sniper elite
Revision 0:b5a6a85fc0d1, committed 2013-10-28
- Comitter:
- rockstar
- Date:
- Mon Oct 28 11:47:58 2013 +0000
- Commit message:
- button wired control for sniper elite
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBDevice.lib Mon Oct 28 11:47:58 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/USBDevice/#335f2506f422
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Oct 28 11:47:58 2013 +0000 @@ -0,0 +1,39 @@ +// GAMING JOYSTICK for sniper elite.... +//button part +// Submitted by- +// Minakshi, Vidisha, Arihant, Anshul, Manisha, Rupam, Vishal +// National Institute of Technology Hamirpur India +// this code simply send some characters which are used for the movement of player in the game +#include "mbed.h" +#include"USBKeyboard.h" // USBKeyboard library taken to send keyboard commands in our program +USBKeyboard mouse1; // object created of USBKeyboard library +DigitalIn forward(p5); // p5 pin is being declared to take analog input and named as forward +DigitalIn backward(p6); // used 3 more digital input at pins p6,p7,p8 +DigitalIn right(p7); +DigitalIn left(p8); +int main() +{ +while(1) +{ +if(forward) + { + mouse1.putc('w'); //if at p5 pin a high inpit is being received then pressing of 'w' will be send to computer through usb + // in game character w is for forward movement of player + } +if(backward) + { + mouse1.putc('s'); // here command of prssing 's' will be send + // s is for backward movement + } +if(left) + { + mouse1.putc('h');// here 'h' will bw send + // h is for shooting + } +if (right) + { + mouse1.putc('j'); //here 'j' will be send + // j is for snipe + } +} +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Oct 28 11:47:58 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file