Adding line stops sketch from running

Hi,

First i am a rookie so please forgive me if the question is stupid…

I made a word clock using NANO with addressable RGB LEDs and sketch for clock works great.
I also added temperature DS18B20 brick sensor which should light up leds for words ‘‘COLD’’, ‘‘HOT’’, and ‘‘WARM’’ depending on temperature.

Here is the problem, if I add a line:

if (TempInC < 20) {
lightup(WordWARM, Black);
}

else {
lightup(WordWARM, Red);

}

This loop works fine.
As soon is I add color line for another word, for example COLD the sketch doesn’t even start none of the LEDS light up and even reset button does nothing.

Example when sketch doesn’t even start:

if (TempInC < 20) {
lightup(WordWarm, Black);
lightup(WordCold, Blue);
}

else {
lightup(WordWARM, Red);
lightup(WordCOLD, Black);

}

If I delete one of the ‘‘lightup’’ lines (doesn’t matter which one) and upload again everything works perfectly again.

This is just part of the whole complicated sketch. Everything works perfectly until I add the second temperature word as described above.

Any ideas what is wrong?

Regards,
Filip

wordclockfilip_temp_light.ino (67.6 KB)

Any ideas what is wrong?

Not without seeing the whole sketch.

How are the colours and the WordWARM/WordCOLD variables defined/declared and what does the lightup() function do ? Does the code use arrays by any chance ?

I added the Sketch in my original post.

You will find this lines under

//Show temerature in color

Not that Word WARM is WordToplo since part of sketch is not in english.

67k of code is too much for me to examine.

How come the program got that big before you encountered this problem?

Can you write a short program that illustrates the problem?

Or is it the size of the program that is the problem - maybe you have used up all the capability in your Arduino?

...R

When I upload it says that there is still some capacity left. Is there any other way I can check the capacity?

You can examine only part of the code till line 211 to see the problem.

The code was copied from instructables and adjusted to my needs. The problem ony started to apear when I added temperature sensor.

The first thing that I would do is to declare all of the arrays as byte instead of int to save some memory and use the F() macro when printing constant strings to shift the use of memory

  Serial.println(F("Arduino Digital Temperature // Serial Monitor Version")); //Print a message

It seems that I cant use byte instead of int in array. I get errors when compiling…

But removing Serial.println all together did the trick! I didn’t manage to get F() macro working.

Thank you!

It seems that I cant use byte instead of int in array. I get errors when compiling...

Post them

I didn't manage to get F() macro working.

What do you mean by this ?