accelerometer trial

Dependencies:   mbed C12832 MMA7660 USBDevice

Revision:
25:f8db641d33ab
Parent:
24:5c54ff941447
Child:
26:f1a0d62af7f9
--- a/main.cpp	Tue Oct 29 20:14:10 2019 +0000
+++ b/main.cpp	Wed Oct 30 19:39:57 2019 +0000
@@ -31,20 +31,20 @@
 
                      }
        
-        if ((!Switch1) && (Switch2)){                                           //letters
+        if ((!Switch1) && (Switch2)){                            //when switch 1 is off and 2 is on the letters will be printed
             
             if (myOrientation == MMA7660::Up) {
 
-                LCD.printf("LEFT");
-                Usbkeyboard.printf ("a\0");                     //instead of simulating pressing of the "left arrow", simulates pressing "a key"
+                LCD.printf("RIGHT");
+                Usbkeyboard.printf ("d\0");                     //instead of simulating pressing of the "left arrow", simulates pressing "a key"
                 led2=0;
                 led1=0;
                 led3=0;
                 led4=1;
             } else if (myOrientation == MMA7660::Down) {
 
-                LCD.printf("right");
-                Usbkeyboard.printf ("d\0");
+                LCD.printf("LEFT");
+                Usbkeyboard.printf ("a\0");
                 led3=0;
                 led1=0;
                 led2=1;
@@ -77,27 +77,27 @@
             }
         }
         
-        else if ((!Switch1) && (!Switch2)){                                     //standby mode
+        else if ((!Switch1) && (!Switch2)){                                     //when both switches are off standby mode is on (all leds are on)
             led3=1;
             led1=1;
             led2=1;
             led4=1;
         }
         
-        else if ((Switch1) && (!Switch2)){                                      //numbers
+        else if ((Switch1) && (!Switch2)){                                      //if switch 1 is on and switch 2 is off the numbers are written
              
              if (myOrientation == MMA7660::Up) {
 
-                    LCD.printf("One");
-                    Usbkeyboard.printf ("1\0");                     //instead of simulating pressing of the "left arrow", simulates pressing "numbers"
+                    LCD.printf("Three");
+                    Usbkeyboard.printf ("3\0");                     //instead of simulating pressing of the "left arrow", simulates pressing "numbers"
                     led2=0;
                     led1=0;
                     led3=0;
                     led4=1;
                 } else if (myOrientation == MMA7660::Down) {
 
-                    LCD.printf("Three");
-                    Usbkeyboard.printf ("3\0");
+                    LCD.printf("One");
+                    Usbkeyboard.printf ("1\0");
                     led3=0;
                     led1=0;
                     led2=1;
@@ -131,21 +131,21 @@
 
         }
         
-        else if ((Switch1) && (Switch2)){                                       //arrows
+        else if ((Switch1) && (Switch2)){                           //when both switches are on the arrows are imputed
                 
                 // A
                 if (myOrientation == MMA7660::Up) {                 //if the orientation is up
 
-                    LCD.printf("Left");                             //print "left" on LCD (due to orientation of the accelerometer on the limb, the directions are changed)
-                    Usbkeyboard.keyCode (LEFT_ARROW);               //device simulates pressing "left arrow key" on the keyboard
+                    LCD.printf("Right");                             //print "left" on LCD (due to orientation of the accelerometer on the limb, the directions are changed)
+                    Usbkeyboard.keyCode (RIGHT_ARROW);               //device simulates pressing "left arrow key" on the keyboard
                     led2=0;                                         //led off
                     led1=0;                                         //led off
                     led3=0;                                         //led off
                     led4=1;                                         //led on
                 } else if (myOrientation == MMA7660::Down) {
 
-                    LCD.printf("Right");
-                    Usbkeyboard.keyCode (RIGHT_ARROW);
+                    LCD.printf("Left");
+                    Usbkeyboard.keyCode (LEFT_ARROW);
                     led3=0;
                     led1=0;
                     led2=1;