Dependencies: mbed C12832 MMA7660 USBDevice
Diff: main.cpp
- Revision:
- 12:b6a803a6450e
- Parent:
- 11:73e8c1bb5467
- Child:
- 13:d29eb4570e27
--- a/main.cpp Thu Oct 10 20:03:05 2019 +0000 +++ b/main.cpp Tue Oct 15 21:06:39 2019 +0000 @@ -4,8 +4,13 @@ #include "C12832.h" MMA7660 Accelerometer (p28,p27); + USBKeyboard Usbkeyboard; C12832 LCD (p5,p7,p6,p8,p11); +BusOut red_led(p21); +BusOut yellow_led(p22); +BusOut blue_led(p23); +BusOut green_led(p24); int main (void) { @@ -31,19 +36,47 @@ wait (0.00000000001); if (Acc_Y>0.08) { //Y axis program - // Usbkeyboard.printf("w\0"); + Usbkeyboard.keyCode (UP_ARROW); + red_led=1; + yellow_led=0; + } else if (Acc_Y<0.08) { // Usbkeyboard.printf("s\0"); Usbkeyboard.keyCode (DOWN_ARROW); - } + red_led=0; + yellow_led=1; + + } else if (Acc_Y<0.06) { + //turn int (main); + red_led=0; + yellow_led=0; + + } else if (Acc_Y>0.00) { + //turn int (main); + red_led=0; + yellow_led=0; + } if (Acc_X>0.08) { //X axis program //Usbkeyboard.printf("w\0"); Usbkeyboard.keyCode (LEFT_ARROW); - } else if (Acc_X<0.0) { + green_led=1; + blue_led=0; + } else if (Acc_X<0.08) { //Usbkeyboard.printf("s\0"); Usbkeyboard.keyCode (RIGHT_ARROW); - } + green_led=0; + blue_led=1; + + } else if (Acc_X<0.06) { + green_led=0; + blue_led=0; + + } else if (Acc_X>0.00) { + green_led=0; + blue_led=0; + //turn int (main); + } /* if (Acc_Z>1.5) { //Z axis program - work in progress Usbkeyboard.printf("w\0"); @@ -53,6 +86,43 @@ //Ussbkeyboard.keyCode (RIGHT_ARROW); } */ + + } - return false; + } + + //UP + /* if (Acc_X>Acc_Y) + if (Acc_Z<0.8) + if (Acc_X<0) + Usbkeyboard.keyCode (UP_ARROW); + red_led=1; + yellow_led=0; + + + if (Acc_Z<0.8) + if (Acc_X>Acc_Y) + if (Acc_X>0) + Usbkeyboard.keyCode (DOWN_ARROW); + red_led=0; + yellow_led=1; + + if (Acc_Z<0.8) + if (Acc_Y>Acc_X) + if (Acc_Y>0) + Usbkeyboard.keyCode (LEFT_ARROW); + green_led=1; + blue_led=0; + + if (Acc_Z<0.8) + if (Acc_Y>Acc_X) + if (Acc_Y<0) + Usbkeyboard.keyCode (RIGHT_ARROW); + green_led=0; + blue_led=1; + + } } +*/ + +