Problem with tabs in Arduino IDE

Hello Guys,

i got a problem with my arduino code for a 24x24 matrix.
The code itself is not the problem, but from one time to annother, arduino will not search for definitions respectively void() funktions in the other tabs of the code.
I changed nothing at the code and this error came for every function or definition from annother tab.

Does anybody else had sometimes such a problem and can you help me?
Its verry frustraiting that i change basically nothing and the code will not compile anymore...

Matrix_Uhrzeit.zip (9,6 KB)

this can have mutliple reasons.
To narrow down the problem you have to provide more information.

post the complete sketch as a codesection.
There is an automatic function for doing this in the Arduino-IDE
just three steps

  1. press Ctrl-T for autoformatting your code
  2. do a rightclick with the mouse and choose "copy for forum"
  3. paste clipboard into write-window of a posting

post the error-message you get as a code-section.

post the path to your *.ino-file.
post the complete content of the subfolder where your *.ino-file is stored

attach the subfolder of this project as a ZIP-file to a posting

best regards Stefan

Thank you!!!

I cant upload a zip cause this is a new account. ive never had an accout on arduino bevor.
A good friend, who has an account postet this question too with the zip code.
His name is Mann03 and the question is only a few minutes old. The title is "Problems with tabs in Arduino IDE"

best regards Stefan

Arduino: 1.8.13 (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

In file included from C:\Users\hanne\OneDrive\Desktop\Arduino\Matrix_Uhrzeit\Matrix_Uhrzeit.ino:4:0:

C:\Users\hanne\OneDrive\Dokumente\Arduino\libraries\FastLED\src/FastLED.h:14:21: note: #pragma message: FastLED version 3.004.000

pragma message "FastLED version 3.004.000"

                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\hanne\OneDrive\Desktop\Arduino\Matrix_Uhrzeit\Matrix_Uhrzeit.ino: In function 'void setup()':

Matrix_Uhrzeit:116:3: error: 'chooseNextColorPalette' was not declared in this scope

chooseNextColorPalette(gTargetPalette);

^~~~~~~~~~~~~~~~~~~~~~

C:\Users\hanne\OneDrive\Desktop\Arduino\Matrix_Uhrzeit\Matrix_Uhrzeit.ino: At global scope:

Matrix_Uhrzeit:121:39: error: 'sinelon' was not declared in this scope

SimplePatternList gPatterns = {Cylon, sinelon, confetti, sinelon, juggle };

                                   ^~~~~~~

Matrix_Uhrzeit:121:48: error: 'confetti' was not declared in this scope

SimplePatternList gPatterns = {Cylon, sinelon, confetti, sinelon, juggle };

                                            ^~~~~~~~

Matrix_Uhrzeit:121:58: error: 'sinelon' was not declared in this scope

SimplePatternList gPatterns = {Cylon, sinelon, confetti, sinelon, juggle };

                                                      ^~~~~~~

Matrix_Uhrzeit:121:67: error: 'juggle' was not declared in this scope

SimplePatternList gPatterns = {Cylon, sinelon, confetti, sinelon, juggle };

                                                               ^~~~~~

C:\Users\hanne\OneDrive\Desktop\Arduino\Matrix_Uhrzeit\Matrix_Uhrzeit.ino: In function 'void loop()':

Matrix_Uhrzeit:150:7: error: 'DemoReel100' was not declared in this scope

   DemoReel100();

   ^~~~~~~~~~~

Matrix_Uhrzeit:155:7: error: 'Noise' was not declared in this scope

   Noise();

   ^~~~~

C:\Users\hanne\OneDrive\Desktop\Arduino\Matrix_Uhrzeit\Matrix_Uhrzeit.ino:155:7: note: suggested alternative: 'noise'

   Noise();

   ^~~~~

   noise

Matrix_Uhrzeit:160:7: error: 'NoisePlayground' was not declared in this scope

   NoisePlayground();

   ^~~~~~~~~~~~~~~

Matrix_Uhrzeit:165:7: error: 'NoisePlusPalette' was not declared in this scope

   NoisePlusPalette();

   ^~~~~~~~~~~~~~~~

C:\Users\hanne\OneDrive\Desktop\Arduino\Matrix_Uhrzeit\Matrix_Uhrzeit.ino:165:7: note: suggested alternative: 'UpscalePalette'

   NoisePlusPalette();

   ^~~~~~~~~~~~~~~~

   UpscalePalette

Matrix_Uhrzeit:170:7: error: 'time_and_numbers' was not declared in this scope

   time_and_numbers();

   ^~~~~~~~~~~~~~~~

Matrix_Uhrzeit:175:7: error: 'TwinkleFox' was not declared in this scope

   TwinkleFox();

   ^~~~~~~~~~

Matrix_Uhrzeit:180:7: error: 'XYMatrix' was not declared in this scope

   XYMatrix();

   ^~~~~~~~

Matrix_Uhrzeit:185:7: error: 'muchRGB' was not declared in this scope

   muchRGB();

   ^~~~~~~

C:\Users\hanne\OneDrive\Desktop\Arduino\Matrix_Uhrzeit\Cylon.ino: In function 'void Cylon()':

Cylon:9:5: error: 'fadeall' was not declared in this scope

 fadeall();

 ^~~~~~~

C:\Users\hanne\OneDrive\Desktop\Arduino\Matrix_Uhrzeit\Cylon.ino:9:5: note: suggested alternative: 'ftell'

 fadeall();

 ^~~~~~~

 ftell

C:\Users\hanne\OneDrive\Desktop\Arduino\Matrix_Uhrzeit\Cylon.ino: At global scope:

Cylon:14:3: error: expected unqualified-id before 'for'

for (int i = (NUM_LEDS) - 1; i >= 0; i--)

^~~

Cylon:14:32: error: 'i' does not name a type

for (int i = (NUM_LEDS) - 1; i >= 0; i--)

                            ^

Cylon:14:40: error: 'i' does not name a type

for (int i = (NUM_LEDS) - 1; i >= 0; i--)

                                    ^

Cylon:22:1: error: expected declaration before '}' token

}

^

exit status 1

'chooseNextColorPalette' was not declared in this scope

Dieser Bericht wäre detaillierter, wenn die Option
"Ausführliche Ausgabe während der Kompilierung"
in Datei -> Voreinstellungen aktiviert wäre.

are your other tabs .ino too or .h and .cpp files ?

Every single tab is an .ino file in the same ordner as the main programm. I have created the tabs in the main programm and not by adding other programms to the ordner.

C:\Users\hanne\OneDrive\Desktop\Arduino\Matrix_Uhrzeit
This is the path and the hole Programm is in the .zip file that i added right now.

C++ requires that a function needs to be declared (or defined) before you can use it.

when you have a bunch of .ino, the IDE concatenates them all into a big .ino file (in alphabetic order if I remember correctly) and then is trying to be smart and generating function prototype for you. But on occasion it will get things wrong.

so may be that's what is biting you. (may be)

what you could do is to declare all your key functions prototype (or the one the compiler is complaining about) at the top of the main sketch. for example if you have a function somewhere in one of the tab that is

int getDataFrom(int source, unsigned long timeout) {
  ... // some code
} 

then keep it there but add at the top of the main sketch

int getDataFrom(int, unsigned long) ;

do this for all functions that are defined in one tab but possibly used in other tabs

I try to declare the first error and it said that it was already declared... but if i delet the

void chooseNextColorPalette();

from the code in this case it says that "chooseNextColorPalette was not declared"

this makes absolutely no sense to me because if i declare it, it says its already declared and if i do nothing just let the funktion in the other tab, it says that its not declared.

that's weird, you can declare the same prototype as many times as you want as long as it's the same...

this will compile fine I'm sure for example

int getDataFrom(int, unsigned long) ;
int getDataFrom(int, unsigned long) ;
int getDataFrom(int, unsigned long) ;
int getDataFrom(int, unsigned long) ;
int getDataFrom(int, unsigned long) ;
int getDataFrom(int, unsigned long) ;
int getDataFrom(int, unsigned long) ;
int getDataFrom(int, unsigned long) ;

int getDataFrom(int source, unsigned long timeout) {
  Serial.println(source);
  Serial.println(timeout);
  return 42;
}

void setup() {
  Serial.begin(115200);
  Serial.println(getDataFrom(10, 20));
}

void loop() {}

EDIT: chooseNextColorPalette takes an argument, so your prototype is wrong. (you call it with gTargetPalette according to the compiler's mistake).

the prototype NEEDS to fully match the types used in the function definition.

if you want you can take a look in the uploadet zip. Its defined fine in the code. My bad sorry!

it's kind of a mess... :slight_smile:

how many RTC library do you need ? I see

#include <DS3231.h>
#include <DS3232RTC.h>

but then you do

RTClib myRTC;

you have not even imported the RTClib and that's not how you instantiate an RTC with that lib

but then you do

'setSyncProvider(RTC.get);' which seems to be from Jack Christensen's DS3231 library...


add this at the top of your file:

void chooseNextColorPalette(CRGBPalette16&);
void Cylon();
void sinelon();
void confetti();
void juggle();
void DemoReel100();
void Noise();
void NoisePlayground();
void NoisePlusPalette();
void time_and_numbers();
void TwinkleFox();
void XYMatrix();
void muchRGB();
void fadeall();

void num0();
void num1();
void num2();
void num3();
void num4();
void num5();
void num6();
void num7();
void num8();
void num9();
void pp();

then go to the ColourPalettePattern tab and add the missing semi-colon at the end.

then go to Cylon tab, remove the semicolon that ended up there at the start of the file and it seems you have an extra curly brackets in the function definition... Try (I just removed it)

void Cylon() {

  static uint8_t hue = 0;
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = CHSV(hue++, 255, 255);
    FastLED.show();
    fadeall();
    delay(10);
  }


  for (int i = (NUM_LEDS) - 1; i >= 0; i--) {
    leds[i] = CHSV(hue++, 255, 255);
    FastLED.show();
    fadeall();
    delay(10);
  }

}

void fadeall() {
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i].nscale8(250);
  }
}

I would suggest you fix the RTC thing by using only ONE library.

Thank you sooooo soooo much!!!!!!!!!!

Yes i know its kind of a mess. Im so sorry.
I have never worked mit an rtc bevore so i tried to bring it together from some example codes.

LG Hannes

sure, we all started somewhere. But just use one library and one RTC object. Either RTClib or the one from Jack Christensen's but not both.

Hello Guys,

i got a problem with my arduino code for a 24x24 matrix.
The code itself is not the problem, but from one time to annother, arduino will not search for definitions respectively void() funktions in the other tabs of the code.
I changed nothing at the code and this error came for every function or definition from annother tab.

Does anybody else had sometimes such a problem and can you help me?
Its verry frustraiting that i change basically nothing and the code will not compile anymore...
Matrix_Uhrzeit.zip (9.6 KB)

There are two problems:
ColourPalettePattern.ino line 127:

const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM =
{
  CRGB::Red,
  CRGB::Gray, 
  CRGB::Blue,
  CRGB::Black,

  CRGB::Red,
  CRGB::Gray,
  CRGB::Blue,
  CRGB::Black,

  CRGB::Red,
  CRGB::Red,
  CRGB::Gray,
  CRGB::Gray,
  CRGB::Blue,
  CRGB::Blue,
  CRGB::Black,
  CRGB::Black
}

There should be a ; at the end of that line.

Cylon.ino line 9:

; void Cylon() {

  static uint8_t hue = 0;
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = CHSV(hue++, 255, 255);
    FastLED.show();
    fadeall();
    delay(10);
    }
  }

  for (int i = (NUM_LEDS) - 1; i >= 0; i--) {
    leds[i] = CHSV(hue++, 255, 255);
    FastLED.show();
    fadeall();
    delay(10);
  }
  
}

There is an extra brace. I also notice the pointless (yet valid) semicolon at the start of line 1. I guess that's where the missing semicolon from myRedWhiteBluePalette_p ended up.

Duplicate posts merged. I'm frustrated that I spent a good deal of time sorting out the problem, only to discover that someone had already done the same here in the other thread, meaning I wasted time I could have put toward helping someone else.

and even worth then with two accounts ?
hreinsch and mann03 (or are they the same, how can it be ?)

gee, I wish I had not spent one minute on this. Such behavior is pathetic. Guys you have no respect.

I banned both accounts from my view so that I will never have to answer to nor hear from them anymore.

Not me....