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.
Fork of EMG_check by
Revision 2:049f61b9ebcb, committed 2016-09-23
- Comitter:
- irfanmoh
- Date:
- Fri Sep 23 14:33:43 2016 +0000
- Parent:
- 1:6605db01437d
- Commit message:
- revision switch on character;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Sep 23 12:55:22 2016 +0000
+++ b/main.cpp Fri Sep 23 14:33:43 2016 +0000
@@ -16,51 +16,44 @@
{
pc.baud(115200);
- // if (sw3 == 0)
- // { // als knopje 3 wordt ingedrukt dan wordt er 1 opgeteld bij n
- // n++;
- // pc.printf("%i \n\r",n);
- // wait (0.5);
- // }
- // else {
- // n=n;
- // pc.printf("geen switch");
- // }
-
+
while (true) {
+ sw3.fall(&SwitchN);
+
+char c = pc.getc();
- sw3.fall(&SwitchN);
+
+
+
- if (n%2 == 0) { //runt menuutje 1 als het even is
- //menu 1
- pc.printf("n is even \n");
- // wait (0.5);
-
- char c = pc.getc();
- if (c == 's'){
- pc.printf("up \n");
- wait (0.5);
- }
- else if (c == 'd'){
- pc.printf("down /n");
- wait (0.5);}
+ switch (c)
+ {
+ case 's':
+ {
+ if (n%2 == 0)
+ {
+ pc.printf("up \n\r");
+ }
+ else
+ {
+ pc.printf("right \n\r");
}
- else { // runt menuutje 2 als het oneven is
- // menu 2
- pc.printf("n is oneven \n");
- // wait (0.5);
- char c = pc.getc();
- if (c == 's'){
- pc.printf("right \n");
- wait (0.5);}
- else if (c == 'd'){
- pc.printf("left /n");
- wait (0.5);}
- else {}
-
- }
+ break;
+ }
+ case 'd':
+ {
+ if (n%2 == 0)
+ {
+ pc.printf("down \n\r"); }
+ else
+ {
+ pc.printf("left \n\r");
+ }
+ break;
+ }
+ }
+
}
}
-
