chetan chowdary
/
subway_surfsfinal
Getting the real feel of subway Surfs.
Revision 0:6f645104ab31, committed 2017-03-22
- Comitter:
- chetan133
- Date:
- Wed Mar 22 16:32:17 2017 +0000
- Commit message:
- Real Time Subway Surfs.
Changed in this revision
diff -r 000000000000 -r 6f645104ab31 USBDevice.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBDevice.lib Wed Mar 22 16:32:17 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/USBDevice/#d17693b10ae6
diff -r 000000000000 -r 6f645104ab31 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Mar 22 16:32:17 2017 +0000 @@ -0,0 +1,63 @@ +#include "mbed.h" +#include "USBKeyboard.h" //making virtual ketboard +#include "USBSerial.h" //Virtual serial port over USB + + AnalogIn inputx(p20); // input pins 20,19,18 for x,y,z axis of ADXL335 respectively. +AnalogIn inputy(p19); +AnalogIn inputz(p18); +Serial pc(USBTX,USBRX); //Serial class for transmission of serial data + +USBKeyboard keyboard; // setting variable +DigitalOut myled1(LED1); + +int main() { + + int x=0,y=0,z=0,a=0,b=0; // variables for x,y,z axes + + while(1) + {pc.baud(9600); //serial communication rate between pc and mbed. + + x=inputx*100+1; + y=inputy*100-2; + z=inputz*100; + myled1=!myled1; + + pc.printf("%d,%d,%d * ",x,y,z); + + if(y<=52&&y>=48) + { + a=0; + } + + if(y>54&&a==0) + { + keyboard.keyCode(RIGHT_ARROW); + a=1; + } + + if(y<46&&a==0) + { + keyboard.keyCode(LEFT_ARROW); + a=1; + } + + if(x>=48&&x<=52) + { + b=0; + } + + if(x<46&&b==0) + { + keyboard.keyCode(DOWN_ARROW); + b=1; + } + + if(x>54&&b==0) + { + keyboard.keyCode(UP_ARROW); + b=1; +} + + } + + } \ No newline at end of file
diff -r 000000000000 -r 6f645104ab31 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Mar 22 16:32:17 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/c0f6e94411f5 \ No newline at end of file