Announcement

Collapse
No announcement yet.

uOLED-96 CRASHES while executing code

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • uOLED-96 CRASHES while executing code

    Hello all, I am having a huge problem. I have created a GUI using the uOLED-96. At first I created the functions seperately, and they all work without a problem, but then I intergrated all the functions recently, and when I go through the menus back and forth, suddenly the screen prints some weird lines and goes blank. I havent implemented any coding to print any line. Please help me discover what the problem is, this is part of my final year project, and the due date is getting near. I am not a professional coder so please excuse my coding methods.

    Thanks.

    Here is my coding:
    Code:
    #platform "GOLDELOX-GFX2"#inherit "4DGL_16bitColours.fnc"var messages1[2],n1:=0,m1:=2,char1,m2:=0;//The main functionfunc main()setbaud(BAUD_9600);displaylogo(); //calls the display functionpause(5000);mainmenu();endfunc//Function for the Mainmenu, here there are two options, Search and Optionsfunc mainmenu()gfx_Set(OUTLINE_COLOUR, BLUE);var messages[4],n:=0,m:=2,char,m1:=0;com_Reset();display:gfx_Set(OUTLINE_COLOUR, BLUE); // set outline colour, gfx_Cls() will draw outlinegfx_Cls();txt_Set(FONT_ID, 1);txt_MoveCursor(1,1);//txt_FGcolour(WHITE);gfx_RectangleFilled(0, 58, 96, 64, BLUE);//gfx_Contrast(0);//txt_Opacity(1);txt_FGcolour(BLUE);// gfx_RectangleFilled(6,52,33,64,WHITE);gfx_RectangleFilled(63,52,90,64,WHITE);txt_MoveCursor(7,9);txt_BGcolour(WHITE);print("Slct");//txt_MoveCursor(7,1);//print("Menu");messages[0]:= "Search";messages[1]:= "Options";messages[2]:= "Turn Off";messages[3]:= "TEST4";txt_MoveCursor(2,4);txt_FGcolour(WHITE);txt_BGcolour(BLACK);putstr(messages[0]);print("\n");putstr(messages[1]);print("\n");putstr(messages[2]);print("\n");putstr(messages[3]);//*********************txt_MoveCursor(m,4);txt_BGcolour(BLUE);putstr(messages[n]);goto random;//*************************endsub;random:repeatchar:=serin();if(char==128) goto up;if(char==129) goto down;if(char==131) goto select;//if(char==130) goto left;//if(char==131) goto right;foreverendsub;up:txt_MoveCursor(2,4);txt_FGcolour(WHITE);txt_BGcolour(BLACK);putstr(messages[0]);print("\n");putstr(messages[1]);print("\n");putstr(messages[2]);print("\n");putstr(messages[3]);//***************************if (n==0)n:=3;m:=5 ;txt_MoveCursor(5,4);txt_BGcolour(BLUE);putstr(messages[3]);else if(n>0)n:=n-1;m:=m-1;txt_MoveCursor(m,4);txt_BGcolour(BLUE);putstr(messages[n]);endifgoto random;endsub;down://*************************txt_MoveCursor(2,4);txt_FGcolour(WHITE);txt_BGcolour(BLACK);putstr(messages[0]);print("\n");putstr(messages[1]);print("\n");putstr(messages[2]);print("\n");putstr(messages[3]);//***************************if (n==3)n:=0;m:=2 ;txt_MoveCursor(2,4);txt_BGcolour(BLUE);putstr(messages[0]);else if(n<=3)n:=n+1;m:=m+1;txt_MoveCursor(m,4);txt_BGcolour(BLUE);putstr(messages[n]);endifgoto random;endsub;select:gfx_Cls();txt_Set(FONT_ID, 1);txt_MoveCursor(1,2);if (n==0)search();endifif(n==1)options();endifprint("Back");//goto random2;endsub;/* random2:repeatchar:=serin();if(char==130) goto press;foreverendsub;press:txt_MoveCursor(6,1);txt_BGcolour(BLUE);putstr("Back");pause(500);goto display;endsub;*//*left:gfx_RectangleFilled(6,52,33,64,PURPLE);txt_MoveCursor(7,1);txt_BGcolour(PURPLE);print("Menu");pause(600);main();*/endsub;endfunc//This is the function to display the logo when the device is turned onfunc displaylogo()gfx_Set(OUTLINE_COLOUR, BLUE); // set outline colour, gfx_Cls() will draw a blue outlinegfx_Cls();txt_Set(FONT_ID,2);txt_MoveCursor(3,1);txt_Width(3);txt_FGcolour(BLUE);print("KUBI");serout(101);endfunc//func search()com_Reset();serout(102);var combuf;var i:=0;com_Init(combuf,1,0);txt_Set(FONT_ID,2);txt_BGcolour(BLACK);txt_FGcolour(BLUE);txt_Width(0);var char;repeatif(!com_Full())if (i<5)txt_Delay(200);gfx_Set(OUTLINE_COLOUR, BLUE); // set outline colour, gfx_Cls() will draw a blue outlinegfx_Cls();txt_MoveCursor(3,1);print("Searching");print("...");txt_Delay(0);endifif(i>=5)gfx_Contrast(0) ;endifi++;endifif(com_Full())if (serin()==130)mainmenu();endifgfx_Contrast(8);serinread();endifforeverendfunc//Function to read from the UART, the value of the matchfunc serinread()var char;char:=serin();if(char==103) matchfound();if (char==104) nonfound();endfunc//Displays that a match is foundfunc matchfound()//serout(9);gfx_Cls();print("FOUND!!");pause(2500);matchmenu();endfunc//Displays that no match is foundfunc nonfound()gfx_Cls();print("None Found!");pause(2500);mainmenu();endfunc//The menu that is displayed once a match is foundfunc matchmenu()com_Reset();setbaud(BAUD_9600);var x;gfx_Set(OUTLINE_COLOUR, BLUE);gfx_Cls();txt_MoveCursor(3,1);print("Match:");repeatx:=serin();if (x>=0) goto printit;foreverprintit:print(x);print("%!!");pause(3000);endsub;endfunc//Options menu from the mainmenufunc options()gfx_Set(OUTLINE_COLOUR, BLUE);//messages1[2];//n1:=0;//m1:=2;//m2:=0;com_Reset();display:gfx_Set(OUTLINE_COLOUR, BLUE); // set outline colour, gfx_Cls() will draw outlinegfx_Cls();txt_Set(FONT_ID, 1);txt_MoveCursor(1,1);//txt_FGcolour(WHITE);gfx_RectangleFilled(0, 58, 96, 64, BLUE);//gfx_Contrast(0);//txt_Opacity(1);txt_FGcolour(BLUE);gfx_RectangleFilled(6,52,33,64,WHITE);gfx_RectangleFilled(63,52,90,64,WHITE);txt_MoveCursor(7,9);txt_BGcolour(WHITE);print("Slct");txt_MoveCursor(7,1);print("Back");messages1[0]:= "Mode";messages1[1]:= "USB";//messages[2]:= "Turn Off";//messages[3]:= "TEST4";txt_MoveCursor(2,4);txt_FGcolour(WHITE);txt_BGcolour(BLACK);putstr(messages1[0]);print("\n");putstr(messages1[1]);///  print("\n");//putstr(messages[2]);// print("\n");// putstr(messages[3]);//*********************txt_MoveCursor(m1,4);txt_BGcolour(BLUE);putstr(messages1[n1]);goto random;//*************************endsub;random:repeatchar1:=serin();if(char1==128) goto up;if(char1==129) goto down;if(char1==131) goto select;if(char1==130) goto left;//if(char==131) goto right;foreverendsub;//***************************up:txt_MoveCursor(2,4);txt_FGcolour(WHITE);txt_BGcolour(BLACK);putstr(messages1[0]);print("\n");putstr(messages1[1]);// print("\n");//putstr(messages[2]);// print("\n");// putstr(messages[3]);if (n1==0)n1:=1;m1:=3 ;txt_MoveCursor(3,4);txt_BGcolour(BLUE);putstr(messages1[1]);else if(n1>0)n1:=n1-1;m1:=m1-1;txt_MoveCursor(m1,4);txt_BGcolour(BLUE);putstr(messages1[n1]);endifgoto random;endsub;//*************************down:txt_MoveCursor(2,4);txt_FGcolour(WHITE);txt_BGcolour(BLACK);putstr(messages1[0]);print("\n");putstr(messages1[1]);//  print("\n");//putstr(messages[2]);// print("\n");// putstr(messages[3]);if (n1==1)n1:=0;m1:=2 ;txt_MoveCursor(2,4);txt_BGcolour(BLUE);putstr(messages1[0]);else if(n1<=1)n1:=n1+1;m1:=m1+1;txt_MoveCursor(m1,4);txt_BGcolour(BLUE);putstr(messages1[n1]);endifgoto random;endsub;//*************************select:gfx_Cls();txt_Set(FONT_ID, 1);txt_MoveCursor(1,2);if (n1==0)search();endifif(n1==1)options();endifprint("Back");//goto random2;endsub;left:gfx_RectangleFilled(6,52,33,64,PURPLE);txt_MoveCursor(7,1);txt_BGcolour(BLUE);print("Back");pause(500);mainmenu();endsub;endfunc














  • #2


    The think that jumps out at me is that you have used goto and 'ended it' with endsub.

    gosub should be 'ended' by endsub.

    goto should be 'ended' by another goto (assuming you wish to alter program flow in that way).
    Mark

    Comment


    • #3


      thanks for your reply ESPsup.

      So do you think that if I used the GOSUB instead of GOTO, it will solve my problem?

      Comment


      • #4


        I tried changing all the 'goto' into 'gosub' but the problem remains.

        Comment


        • #5


          Without spending an inordinate of time trying to understand the code I can't get it to missbehave.

          What's the easiset sequence to send to it to cause it to stuff up?
          Mark

          Comment


          • #6


            Did you actually try loading it into a module? I have written it in such a way that the menu can be controlled by the use of the ARROW keys, UP and DOWN to navigate, and RIGHT is to select, finally the LEFT is back.

            I can go in and out of sub menus about 3 times, but when I try to go back in, the whole thing dissapears and there's nothing on the screen.

            Comment


            • #7


              Please Note that I have so far created the Options and Search submenus, it is not possible to go beyond those, for example the MODE and USB in the Options menu can not be selected.

              You have to send the commands through the Terminal at a Baudrate of 9600

              Comment


              • #8
                Hi ESPsupport,

                I've replaced all the subroutines with seperate functions and tried to run the program, but it doesn't even get that far.

                Then I tried one of my initial coding just for the up and down navigation, it works without a problem. So it cant be a problem with the way I used the subroutines, right?

                Please help me to sort this out today. Thanks.
                Coding:
                Code:
                #platform "GOLDELOX-GFX2"#inherit "4DGL_16bitColours.fnc"func main()setbaud(BAUD_9600);gfx_Set(OUTLINE_COLOUR, BLUE);var messages[4],n:=0,m:=2,char;display:gfx_Cls();messages[0]:= "TEST1";messages[1]:= "TEST2";messages[2]:= "TEST3";messages[3]:= "TEST4";txt_MoveCursor(2,4);txt_FGcolour(WHITE);txt_BGcolour(BLACK);putstr(messages[0]);print("\n");putstr(messages[1]);print("\n");putstr(messages[2]);print("\n");putstr(messages[3]);//*********************txt_MoveCursor(m,4);txt_BGcolour(BLUE);putstr(messages[n]);goto random;//*************************endsub;random:repeatchar:=serin();if(char==128) goto up;if(char==129) goto down;if(char==13) goto select;foreverendsub;up:txt_MoveCursor(2,4);txt_FGcolour(WHITE);txt_BGcolour(BLACK);putstr(messages[0]);print("\n");putstr(messages[1]);print("\n");putstr(messages[2]);print("\n");putstr(messages[3]);//***************************if (n==0)n:=3;m:=5 ;txt_MoveCursor(5,4);txt_BGcolour(BLUE);putstr(messages[3]);else if(n>0)n:=n-1;m:=m-1;txt_MoveCursor(m,4);txt_BGcolour(BLUE);putstr(messages[n]);endifgoto random;endsub;down://*************************txt_MoveCursor(2,4);txt_FGcolour(WHITE);txt_BGcolour(BLACK);putstr(messages[0]);print("\n");putstr(messages[1]);print("\n");putstr(messages[2]);print("\n");putstr(messages[3]);//***************************if (n==3)n:=0;m:=2 ;txt_MoveCursor(2,4);txt_BGcolour(BLUE);putstr(messages[0]);else if(n<=3)n:=n+1;m:=m+1;txt_MoveCursor(m,4);txt_BGcolour(BLUE);putstr(messages[n]);endifgoto random;endsub;select:// set outline colour, gfx_Cls() will draw outlinegfx_Cls();txt_Set(FONT_ID, 0);txt_MoveCursor(1,2);txt_BGcolour(BLACK);putstr(messages[n]);txt_MoveCursor(6,1);print("Back");goto random2;endsub;random2:repeatchar:=serin();if(char==130) goto press;foreverendsub;press:txt_MoveCursor(6,1);txt_BGcolour(BLUE);putstr("Back");pause(500);goto display;endsub;endfunc

                Comment


                • #9
                  not tried it on a display but try this - using functions

                  #platform "GOLDELOX-GFX2"
                  #inherit "4DGL_16bitColours.fnc"
                  var messages[4],n:=0,m:=2,char;
                  func display()
                  gfx_Cls();
                  messages[0]:= "TEST1";
                  messages[1]:= "TEST2";
                  messages[2]:= "TEST3";
                  messages[3]:= "TEST4";
                  txt_MoveCursor(2,4);
                  txt_FGcolour(WHITE);
                  txt_BGcolour(BLACK);
                  putstr(messages[0]);
                  print("\n");
                  putstr(messages[1]);
                  print("\n");
                  putstr(messages[2]);
                  print("\n");
                  putstr(messages[3]);
                  //*********************
                  txt_MoveCursor(m,4);
                  txt_BGcolour(BLUE);
                  putstr(messages[n]);
                  endfunc
                  func up()
                  txt_MoveCursor(2,4);
                  txt_FGcolour(WHITE);
                  txt_BGcolour(BLACK);
                  putstr(messages[0]);
                  print("\n") ;
                  putstr(messages[1]);
                  print("\n") ;
                  putstr(messages[2]);
                  print("\n") ;
                  putstr(messages[3]);
                  //***************************
                  if (n==0)
                  n:=3;
                  m:=5 ;
                  txt_MoveCursor(5,4);
                  txt_BGcolour(BLUE);
                  putstr(messages[3]);
                  else if(n>0)
                  n:=n-1;
                  m:=m-1;
                  txt_MoveCursor(m,4);
                  txt_BGcolour(BLUE);
                  putstr(messages[n]);
                  endif
                  endfunc
                  func down()
                  //*************************
                  txt_MoveCursor(2,4);
                  txt_FGcolour(WHITE);
                  txt_BGcolour(BLACK);
                  putstr(messages[0]);
                  print("\n") ;
                  putstr(messages[1]);
                  print("\n") ;
                  putstr(messages[2]);
                  print("\n") ;
                  putstr(messages[3]);
                  //***************************
                  if (n==3)
                  n:=0;
                  m:=2 ;
                  txt_MoveCursor(2,4);
                  txt_BGcolour(BLUE);
                  putstr(messages[0]);
                  else if(n<=3)
                  n:=n+1;
                  m:=m+1;
                  txt_MoveCursor(m,4);
                  txt_BGcolour(BLUE);
                  putstr(messages[n]);
                  endif
                  endfunc
                  func select()

                  // set outline colour, gfx_Cls() will draw outline
                  gfx_Cls();
                  txt_Set(FONT_ID, 0);
                  txt_MoveCursor(1,2);
                  txt_BGcolour(BLACK);
                  putstr(messages[n]);
                  txt_MoveCursor(6,1);
                  print("Back") ;
                  endfunc
                  func pressss()
                  txt_MoveCursor(6,1);
                  txt_BGcolour(BLUE);
                  putstr("Back") ;
                  pause(500);
                  display();
                  endfunc
                  func main()
                  setbaud(BAUD_9600);
                  gfx_Set(OUTLINE_COLOUR, BLUE);
                  display();
                  repeat
                  char:=serin();
                  if(char==128) up();
                  if(char==129) down();
                  if(char==13) select();
                  if(char==130) pressss();
                  forever
                  endfunc

                  Comment


                  • #10


                    not tried it on a display but try this - using functions
                    Yes, much better idea. Gotos are not a reccomended coding technique. If you need to use them only a couple, otherwise you end up with spaghetti code which is impossible to understand or debug
                    Mark

                    Comment


                    • #11


                      hi kaddrison, thanks for your time,

                      but as i mentioned in my last post :
                      Then I tried one of my initial coding just for the up and down navigation, it works without a problem. So it cant be a problem with the way I used the subroutines, right?
                      The coding where you converted the subroutines into functions, works well with the subroutines.

                      Espsupport, when we learned programming in C, we were told by our lecturers to use the Gotos. I cant remember exactly why but it was something to do with the memory. Is there anyway that I can give the module a software reset? Without actually turning it off?

                      Comment


                      • #12
                        Allright guys, I wrote the whole coding without using any subroutines as suggested by ESPSupport. The problem remains!!!

                        Code:
                        #platform "GOLDELOX-GFX2"#inherit "4DGL_16bitColours.fnc"var messages1[2],n1:=0,m3:=2,char1,m2:=0;var messages[4],n:=0,m:=2,char,m1:=0;func main()setbaud(BAUD_9600);displaylogo(); //calls the display functionpause(3000);mainmenu();endfuncfunc display()gfx_Set(OUTLINE_COLOUR, BLUE); // set outline colour, gfx_Cls() will draw outlinegfx_Cls();txt_Set(FONT_ID, 1);txt_MoveCursor(1,1);//txt_FGcolour(WHITE);gfx_RectangleFilled(0, 58, 96, 64, BLUE);//gfx_Contrast(0);//txt_Opacity(1);txt_FGcolour(BLUE);// gfx_RectangleFilled(6,52,33,64,WHITE);gfx_RectangleFilled(63,52,90,64,WHITE);txt_MoveCursor(7,9);txt_BGcolour(WHITE);print("Slct");//txt_MoveCursor(7,1);//print("Menu");messages[0]:= "Search";messages[1]:= "Options";messages[2]:= "Turn Off";messages[3]:= "TEST4";txt_MoveCursor(2,4);txt_FGcolour(WHITE);txt_BGcolour(BLACK);putstr(messages[0]);print("\n");putstr(messages[1]);print("\n");putstr(messages[2]);print("\n");putstr(messages[3]);//*********************txt_MoveCursor(m,4);txt_BGcolour(BLUE);putstr(messages[n]);//*************************endfuncfunc up()txt_MoveCursor(2,4);txt_FGcolour(WHITE);txt_BGcolour(BLACK);putstr(messages[0]);print("\n");putstr(messages[1]);print("\n");putstr(messages[2]);print("\n");putstr(messages[3]);//***************************if (n==0)n:=3;m:=5 ;txt_MoveCursor(5,4);txt_BGcolour(BLUE);putstr(messages[3]);else if(n>0)n:=n-1;m:=m-1;txt_MoveCursor(m,4);txt_BGcolour(BLUE);putstr(messages[n]);endifendfuncfunc down()//*************************txt_MoveCursor(2,4);txt_FGcolour(WHITE);txt_BGcolour(BLACK);putstr(messages[0]);print("\n");putstr(messages[1]);print("\n");putstr(messages[2]);print("\n");putstr(messages[3]);//***************************if (n==3)n:=0;m:=2 ;txt_MoveCursor(2,4);txt_BGcolour(BLUE);putstr(messages[0]);else if(n<=3)n:=n+1;m:=m+1;txt_MoveCursor(m,4);txt_BGcolour(BLUE);putstr(messages[n]);endifendfuncfunc select()gfx_Cls();txt_Set(FONT_ID, 1);txt_MoveCursor(1,2);if (n==0)//search();endifif(n==1)//print("OPTIONS");//pause(3000);options();endifprint("Back");//goto random2;endfuncfunc mainmenu()n:=0;m:=2;m1:=0;gfx_Set(OUTLINE_COLOUR, BLUE);com_Reset();display();repeatchar:=serin();if(char==128) up();if(char==129) down();if(char==131) select();//if(char==130) goto left;//if(char==131) goto right;foreverendfuncfunc search()com_Reset();serout(102);var combuf;var i:=0;com_Init(combuf,1,0);txt_Set(FONT_ID,2);txt_BGcolour(BLACK);txt_FGcolour(BLUE);txt_Width(0);var char;repeatif(!com_Full())if (i<5)txt_Delay(200);gfx_Set(OUTLINE_COLOUR, BLUE); // set outline colour, gfx_Cls() will draw a blue outlinegfx_Cls();txt_MoveCursor(3,1);print("Searching");print("...");txt_Delay(0);endifif(i>=5)gfx_Contrast(0) ;endifi++;endifif(com_Full())if (serin()==130)mainmenu();endifgfx_Contrast(8);serinread();endifforeverendfuncfunc serinread()com_Reset();var char;char:=serin();if(char==103) matchfound();if (char==104) nonfound();endfuncfunc matchfound()//serout(9);gfx_Cls();print("FOUND!!");pause(2500);matchmenu();endfuncfunc nonfound()gfx_Cls();print("None Found!");pause(2500);mainmenu();endfuncfunc matchmenu()com_Reset();setbaud(BAUD_9600);var x;gfx_Set(OUTLINE_COLOUR, BLUE);gfx_Cls();txt_MoveCursor(3,1);print("Match:");repeatx:=serin();if (x>=0)print(x);print("%!!");pause(3000);endifforeverendfuncfunc display1()gfx_Set(OUTLINE_COLOUR, BLUE); // set outline colour, gfx_Cls() will draw outlinegfx_Cls();txt_Set(FONT_ID, 1);txt_MoveCursor(1,1);//txt_FGcolour(WHITE);gfx_RectangleFilled(0, 58, 96, 64, BLUE);//gfx_Contrast(0);//txt_Opacity(1);txt_FGcolour(BLUE);gfx_RectangleFilled(6,52,33,64,WHITE);gfx_RectangleFilled(63,52,90,64,WHITE);txt_MoveCursor(7,9);txt_BGcolour(WHITE);print("Slct");txt_MoveCursor(7,1);print("Back");messages1[0]:= "Mode";messages1[1]:= "USB";//messages[2]:= "Turn Off";//messages[3]:= "TEST4";txt_MoveCursor(2,4);txt_FGcolour(WHITE);txt_BGcolour(BLACK);putstr(messages1[0]);print("\n");putstr(messages1[1]);///  print("\n");//putstr(messages[2]);// print("\n");// putstr(messages[3]);//*********************txt_MoveCursor(m3,4);txt_BGcolour(BLUE);putstr(messages1[n1]);endfuncfunc up1()txt_MoveCursor(2,4);txt_FGcolour(WHITE);txt_BGcolour(BLACK);putstr(messages1[0]);print("\n");putstr(messages1[1]);// print("\n");//putstr(messages[2]);// print("\n");// putstr(messages[3]);if (n1==0)n1:=1;m3:=3 ;txt_MoveCursor(3,4);txt_BGcolour(BLUE);putstr(messages1[1]);else if(n1>0)n1:=n1-1;m3:=m3-1;txt_MoveCursor(m3,4);txt_BGcolour(BLUE);putstr(messages1[n1]);endifendfuncfunc down1()txt_MoveCursor(2,4);txt_FGcolour(WHITE);txt_BGcolour(BLACK);putstr(messages1[0]);print("\n");putstr(messages1[1]);//  print("\n");//putstr(messages[2]);// print("\n");// putstr(messages[3]);if (n1==1)n1:=0;m3:=2 ;txt_MoveCursor(2,4);txt_BGcolour(BLUE);putstr(messages1[0]);else if(n1<=1)n1:=n1+1;m3:=m3+1;txt_MoveCursor(m3,4);txt_BGcolour(BLUE);putstr(messages1[n1]);endifendfuncfunc select1()gfx_Cls();txt_Set(FONT_ID, 1);txt_MoveCursor(1,2);if (n1==0)//search();endifif(n1==1)options();endifprint("Back");endfuncfunc displaylogo()gfx_Set(OUTLINE_COLOUR, BLUE); // set outline colour, gfx_Cls() will draw a blue outlinegfx_Cls();txt_Set(FONT_ID,2);txt_MoveCursor(3,1);txt_Width(3);txt_FGcolour(BLUE);print("KUBI");serout(101);endfuncfunc left1()gfx_RectangleFilled(6,52,33,64,PURPLE);txt_MoveCursor(7,1);txt_BGcolour(BLUE);print("Back");pause(500);mainmenu();endfuncfunc options()com_Reset();gfx_Set(OUTLINE_COLOUR, BLUE);display1();repeatchar1:=serin();if(char1==128) up();if(char1==129) down1();if(char1==131) select1();if(char1==130) left1();//if(char==131) goto right;foreverendfunc

                        Comment


                        • #13


                          Now there's an improvement

                          You'd better check with your lecturers, AFAIK gotos have been pretty much 'forbidden' for 30 years.

                          I went into and out 5 times without any problems.

                          But it sure looks like you are recursively calling mainmenu
                          Mark

                          Comment


                          • #14


                            Anymore suggestions ESPsupport?

                            Not many people know about these modules, so I have no other place to go.

                            Is there any other way I can create menus without using the methods that I used?

                            Comment


                            • #15


                              But it sure looks like you are recursively calling mainmenu
                              Do you understand what that means?

                              Whilst recursion is a valid programming technique, the way you have done it will eventually crash the code. ANY code on ANY computer.

                              From mainmenu you call select which calls options which calls left1 which calls mainmenu.

                              This is just wrong.

                              Computers only do what they are told to.

                              Fix your program and join the thousands of people using these modules successfully.
                              Mark

                              Comment

                              Working...
                              X