Arduino IDE 1.6.4 won't compile when I break code in tabs

Hello,
I tried breaking code that works in tabs so I don't have to scroll around that much. Now it won't compile. It just sits at around 20% with no error. Main function is node-soba.ino and side file is meni.ino. I tried to google it on internet and forums and everywhere it says that if tab is in .ino format it is just added at end of main .ino file
Thank you very much for your advices

meni.ino (6.55 KB)

Node-soba.ino (5.26 KB)

One quirk of the IDE is that .ino files are concatenated in alphanumeric order by name. You might want to rename the files so that they are concatenated in the order that you think they should be.

  do {
    if (i != j) {
      lcd.setCursor(0, 1);
      lcd.print("                ");
      lcd.setCursor(0, 1);
      lcd.print(meni[i]);
      j = i;
    }

    if (!digitalRead(gumb_za_osvijetljenje)) if (gumb(gumb_za_osvijetljenje)) if (j < (broj_menija - 1)) i++;
    if (!digitalRead(gumb_za_vrijeme)) if (gumb(gumb_za_vrijeme)) if (j > 0) i--;
    if (!digitalRead(gumb_za_potvrdu)) if (gumb(gumb_za_potvrdu)) break;
  } while (1);

This code is absolutely the worst structured mess I've seen this month. There is no reason to have more than one statement per line.

If statements, for legibility, should always have curly braces.

In my opinion, the do/while statement should have been omitted from the language. Far too many people, including you, abuse the statement.

Seky:
I tried breaking code that works in tabs so I don't have to scroll around that much. Now it won't compile. It just sits at around 20% with no error. Main function is node-soba.ino and side file is meni.ino. I tried to google it on internet and forums and everywhere it says that if tab is in .ino format it is just added at end of main .ino file
Thank you very much for your advices

Why do you have .ino and .ino tabs?

I'm always have ONE .ino file, which is the main sketch file.

And all additional tabs are named as .h files and then included in the sketch.

Example:

  • myProject.ino (main file)
  • myFunctions.h (extra tab)

And in the main sketch there is an include line like:

#include "myFunctions.h"

PaulS: I know it is mess. This is just little something to get hold of making menus on LCD displays and to play around. I usually do include brackets and put everything in new line. This was just 2 days of playing with LCD so i didn't bother. Thanks for input. I will try renaming them

jurs: I have seen that. I just thought it is easier to just put one file that just continues on after loop. But if I don't manage to get that working i will put some headers tabs.. Thanks

Update: I tried renaming the meni.ino to zmeni.ino and also tried deleting it and putting everything to meni.h and including it. Same thing happens. It stops on 20% and stay that way with no error

Seky:
Update: I tried renaming the meni.ino to zmeni.ino and also tried deleting it and putting everything to meni.h and including it. Same thing happens. It stops on 20% and stay that way with no error

I think your problem has to do something with the fact that you are using the same identifier "meni" three times for different things:

  • "meni" as the file name
  • "meni" as the name of an array
  • "meni" as the name of a function

So if you renamed meni.ino to zmeni.ino, there is still a double usage of the "meni" identifier:

char meni[4][16] = { ...

and

void meni() {...

Looks like you are not yet finished renaming all your 'meni' usages to unique identifiers.

jurs thank you for that. I didn't even notice. Apparently when I transferred part of code to another location it bugged my DS1302 library. When I turn on show verbose output on compile I can see that it compiles up to that library and then it is just on it and can't put it to temporary folder. And before that it was compiling normally. After I have find out about that i merged my code back together, but again that library was problem. I have now downloaded different library and it compiles while in other .ino tabs with no includes necessary