If I comment the green line.....everything is fine.
If I comment the red line....everything is fine.
If I comment the yellow line.....everything is fine as well.
I guess it will work commenting any other line
It only fails when all lines are active....It is like I have reach some kind of memory limit.....but after comment one of these lines and upload the code to my arduino uno, the output says this (sorry, it is in spanish):
El Sketch usa 28556 bytes (88%) del espacio de almacenamiento de programa. El máximo es 32256 bytes.
Las variables Globales usan 687 bytes (33%) de la memoria dinámica, dejando 1361 bytes para las variables locales. El máximo es 2048 bytes.
....I have never seen this before....and I am quite lost. Any idea?
Enable verbose output during compilation in options, and post the output you get from that - this will be very informative, because it will tell us whether the failure happens immediately (which would imply that it couldn't possibly be dependent on the content of the sketch). If it fails part-way through, try a few times and see if it always stops at the same point.
What board, and how are you programming it? What is connected to the arduino?
Does that link between whether it works and the code being compiled reproduce consistently? I am suspicious that it doesn't, and if you repeated your experiment, you'd find that in general it works most of the time, failing randomly. (I can conceive of ways that it could possibly depend on the sketch being uploaded, but they all really strain the bounds of plausibility - whereas an apparently random failure could be explained in many ways that we can't rule out from the information you have provided)
Where is the rest of the sketch? Don't post snippets. When you have a problem with your code, and you are posting on forum because you can't fix it, that also means that you are not qualified to say where in your code the problem is. Almost always when someone posts a snippet that they think contains the problem, the problem is in fact somewhere else. Same about bitmaps.h?
Oh, and in general, don't post pictures of text. Anywhere. Ever. For the error output, there's even a button you can click to copy it to clipboard! Post the text, in code tags (the </> button at the top left when making a post)
I have enabled verbose output, the output is attached to the post (it is too large).
I have repeated the tests several times, always exactly same results. This code always fails with same output. If I comment 1 line, it does not matter which one, everything is ok. I have tested commenting 8-10 different lines, all across the whole sketch and always the upload works ok. So...It like a have reach some kind of limit.....
In my project I am using a genuine arduino UNO with a TFT shield and some sensors, but I have disconnected everything, leaving just the arduino before upload the sketch and same results.
If you do export compiled binary for the version that fails, what's the last couple of lines in the hex file? (just as a sanity check that the sketch size really does match with what is being uploaded - I'd be surprised if this turned up anything, but it's a 2 minute test so might as well)
I have removed the code to write debug info in serial port and now It looks that I can carry on adding more code but I guess the error will occurs again in the near future.... I will reach this strange limit again.
If it depends on sketch size I would suspect the USB/serial transceiver. Serial line is out of sync after some time.
Which exact type of Arduino, clone or genuine? Which USB/serial chip?
You can try to decrease transfer speed e.g. to half but it requires to upload modified bootloader.
Budvar10:
If it depends on sketch size I would suspect the USB/serial transceiver. Serial line is out of sync after some time.
Which exact type of Arduino, clone or genuine? Which USB/serial chip?
You can try to decrease transfer speed e.g. to half but it requires to upload modified bootloader.
It is a genuine Arduino UNO (an old one).
Which USB/serial chip? -> I don't know this, where can I find this info?