jakob schreib mir bitte die methode auf int postion

Dependencies:   TextLCD mbed

Fork of Mbed-Mensch-3-Menu by Projekte_werkstatt

Revision:
7:bd4b77580026
Parent:
6:eda2b36d5be1
--- a/main.cpp	Fri Mar 11 07:52:54 2016 +0000
+++ b/main.cpp	Mon Mar 14 18:06:26 2016 +0000
@@ -42,17 +42,21 @@
 void exit();
 void print_menu();
 void Control();
+void ausfuehren();
 
 //string test ("");
 //                                "1234567890123456789","1234567890123456789","1234567890123456789","1234567890123456789",  ,"1234567890123456789","1234567890123456789","1234567890123456789",
-const char * const  text_ln0[] = {"MENU:              ","Spiel-Menu:        ","Anzeige-Menu:      ","Speicher-Menu:     ","","7.Zustand-Menu:    ","Farben-Menu:       ","Spiel-Menu:        ","","Spielregeln-Menu:  ","Hell./Sp.Led-Menu: ","Config-Menu:       ","","Autplay-Menu:      ","Wurfel-Menu:       ","Ofline/Com-Menu:   "};
-const char * const  text_ln1[] = {"Spiel              ","7.Zustand          ","Farben             ","Spiel              ","","Disable            ","                   ","Laden              ","","Smeiszwang <I/0>   ","Wert: <wert>       ","Laden              ","","Zeit               ","Farbverhalten      ","New                "};
-const char * const  text_ln2[] = {"Anzeige            ","Spielregeln        ","Hellichkeit/Sp.Led ","Config.            ","","kleinstmoglich     ","SP: 1   2   3   4  ","Speichern          ","","Go Home first <I/0>","Sp.Led-Verhalten   ","Speichern          ","","Agro/Taktik        ","Farb def           ","Reset              "};
-const char * const  text_ln3[] = {"Speicher           ","Autoplay           ","Wurfel             ","Ofline/Com         ","","grostmoglich       ","                   ","Reset              ","","Ausfahrzwang <I/0> ","Andert: <wert>     ","Reset              ","","Enable/Manuell     ","Hellichkeit        ","Com                "};
+const char * const  text_ln0[] = {"MENU:              ","Spiel-Menu:        ","Anzeige-Menu:      ","Speicher-Menu:     ","","7.Zustand-Menu:    ","Farben-Menu:       ","Spiel-Menu:        ","","Spielregeln-Menu:  ","Hell./Sp.Led-Menu: ","Config-Menu:       ","","Autplay-Menu:      ","Wurfel-Menu:       ","Ofline/Com-Menu:   ","","Colour-Menu        "};
+const char * const  text_ln1[] = {"Spiel              ","7.Zustand          ","Farben             ","Spiel              ","","Disable            ","accept             ","Laden              ","","Schmeiszwang <I/0> ","Wert: <wert>       ","Laden              ","","Zeit               ","Farbverhalten      ","New                ","","RED"};
+const char * const  text_ln2[] = {"Anzeige            ","Spielregeln        ","Hellichkeit/Sp.Led ","Config.            ","","Enable             ","SP: 1   2   3   4  ","Speichern          ","","Go Home first <I/0>","Sp.Led-Verhalten   ","Speichern          ","","Agro/Taktik        ","Farb def           ","Reset              ","","BLU"};
+const char * const  text_ln3[] = {"Speicher           ","Autoplay           ","Wurfel             ","Ofline/Com         ","","                   ","                   ","Reset              ","","Ausfahrzwang <I/0> ","Andert: <wert>     ","Reset              ","","Enable/Manuell     ","Hellichkeit        ","Com                ","","GRE"};
+// xx/xx/xx/xx/Xx
+//  4  3  2  1  0       //ebenen
 
+char selected[256];//Auf welchem Punkt er im Menü ist bzw zuletzt war
+char depth = 0;//WEnn man nicht im Menü ist ist es n0; bei 1 in menu bei 2 in untermenu
+int postion = 0;//Dafür brauche ich die Methode
 
-char selected[256];
-char depth = 0;
 
 int main() 
 {
@@ -66,7 +70,7 @@
     //.detach();
     
     //myled = 0xFFF;
-    port.baud(76800);
+    port.baud(76800);       //zu übertragung für den PC
     port.format(8,Serial::None, 1); 
     port.attach(&Control);
     /*
@@ -74,16 +78,16 @@
     __enable_irq();
     */
     wait(0.01);
-    DD_A.mode(PullDown);
+    DD_A.mode(PullDown);//Schaltet indern einen Pulldown WIeder ein
     DD_B.mode(PullDown);
     DD_C.mode(PullDown);
-    DD_A.rise(&dreh);
+    DD_A.rise(&dreh);//Interrupt rudine zuweisen
     DD_A.fall(&dreh);
     DD_B.rise(&dreh);
     DD_B.fall(&dreh);
     DD_C.rise(&druck);
     DD_C.fall(&druck);
-    DD_last = DD;
+    DD_last = DD;//fürs entprellen
     DD_d=DD_D;
     
     //text_ln0[0]="";
@@ -178,21 +182,26 @@
 {
     if(depth>0)
     {
-        if(depth<=3)
-        {
-            if(selected[depth-1]==0)
-                exit();
-            else
+        
+            if(depth<=3)
             {
-                selected[depth]=1;
-                depth++;
+                if(selected[depth-1]==0)
+                    exit();
+                else
+                {
+                    selected[depth]=1;
+                    depth++;
+                }
             }
-        }
     }
     else
         depth=1;
     print_menu();
 }
+bool ausfuehren()
+{
+
+}
 void exit()
 {
     if(depth>0)
@@ -235,7 +244,7 @@
             for(char i=0;i<4;i++)
             {
                 lcd.locate(0,i);
-                if((selected[depth-1]+0)==i)
+                if(selected[depth-1]==i)
                 {
                     if(i==0)
                     {