Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed C12832 MMA7660 USBDevice
Diff: main.cpp
- Revision:
- 22:a255721ffc58
- Parent:
- 18:660b5780aaa3
- Child:
- 23:4bf323a37a92
--- a/main.cpp Sat Oct 26 17:23:19 2019 +0000
+++ b/main.cpp Sun Oct 27 17:18:19 2019 +0000
@@ -39,7 +39,9 @@
}
- if (Switch1){ //if the switch is on
+ if (Switch1){ //if the switch1 is on
+
+ if (Switch2){ //if switch2 is on
if (myOrientation == MMA7660::Up){ //if the orientation is up
@@ -82,11 +84,60 @@
else if (myOrientation == MMA7660::Unknown){
LCD.printf("Don't Know");
-
+
}
}
+ }
+ else { //if switch2 is off
+
+ if (myOrientation == MMA7660::Up){
+
+ LCD.printf("One");
+ Usbkeyboard.printf ("1\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");
+ led3=0;
+ led1=0;
+ led2=1;
+ led4=0;
+ }
+ else if (myOrientation == MMA7660::Left){
+
+ LCD.printf("Two");
+ Usbkeyboard.printf ("2\0");
+ led1=1;
+ led3=0;
+ led2=0;
+ led4=0;
+ }
+ else if (myOrientation == MMA7660::Right){
+
+ LCD.printf("Four");
+ Usbkeyboard.printf ("4\0");
+ led4=0;
+ led1=0;
+ led3=1;
+ led2=0;
+
+
+
+ }
+
+
+ else if (myOrientation == MMA7660::Unknown){
+
+ LCD.printf("Don't Know");
+
+ }
- else { //if the switch is off than
+ else { //if the switch1 and 2 are off than
if (myOrientation == MMA7660::Up){
@@ -127,6 +178,7 @@
}
+
else if (myOrientation == MMA7660::Unknown){
LCD.printf("Don't Know");
@@ -139,3 +191,4 @@
}
return false;
}
+}
\ No newline at end of file