Game controller for FUJI CAR driving game. Dominic Cincione, Zach Gima, Max Micali.
Dependencies: DebounceIn USBDevice mbed
Fork of mouseTest by
main.cpp
- Committer:
- dpcinci
- Date:
- 2014-09-28
- Revision:
- 1:7b6bc8042945
- Parent:
- 0:e23fabfe5cbd
- Child:
- 2:c67ad98122e0
File content as of revision 1:7b6bc8042945:
#include "mbed.h" #include "USBMouse.h" //Serial pc(USBTX, USBRX); AnalogIn xAxis(A3); AnalogIn yAxis(A4); DigitalIn go(D10); DigitalOut led1(LED2); DigitalOut led2(LED3); float x = 0; float y = 0; float xStatic = 0.71; float yStatic = 0.71; int i = 50; float waitTime; USBMouse mouse; int main() { led1 = 1; led2 = 1; xStatic = 0.7; yStatic = 0.7; /* while(i--){ xStatic = xAxis.read(); yStatic = yAxis.read(); led.write(0.9); wait(0.01); } led.write(1); */ while(1) { x = (xAxis.read()-xStatic)*50; y = (yAxis.read()-yStatic)*(-50); mouse.move(x,y); if(go==0){ led1 = 0; led2 = 1; } if(go==1){ led1 = 1; led2 = 0; } wait(0.01); } }