Sketch Stuck In Uploading! HELP!

Hi guys, I have two set of codes, the first one is the version 1.

Please check the first code in attachments, name: CODE1.

== The code above works perfectly, however, I need to do some modifications because the Facebook API doesn’t accept statuses that are similar. So I need to modify my codes above to pick a random string/status in a array of strings. This sketch by the way can be uploaded to the mega board within a couple of seconds.

Binary sketch size: 38,568 bytes (of a 258,048 byte maximum)


Ok, check this another one, smaller in sketch size:
Binary sketch size: 26,244 bytes (of a 258,048 byte maximum)

BUT, it takes forever to upload, in fact the Arduino IDE gave me a timeout.

Please check the code in attachments NAME: try. Message exceeds the max allowed length.

What can you suggest here? I suspect that this happens (forever-timeout uploading of sketch) because of my string arrays. If so, what are my options, or alternatives for the string arrays?

PS: don’t mind the declarations in Setup() method and don’t tell me to use for loops. I am doing this (again) for certain purposes.

THANK YOU!
Glenn

CODE1.ino (9.07 KB)

try.ino (6.79 KB)

Please allow me, I have no option to show my codes, it exceeds 9000 characters.

You DO have an option. Use Reply, not Quick Reply. Select the Additional Options link, and attach your code here.

ok thanks Paul. I have attached my codes. :D

Do you have the "verbose" during compilation and upload enabled? If so, could you post the compiler output? Even partial.

If you suspect the "string" slowing thing down I would suggest to enclose them in preprocessor directives, unless you are checking for the string presence in code of course, and bypass them for test purposes. In theory these are just another variables and should not make the compiler crawl.

I suspect that this happens (forever-timeout uploading of sketch) because of my string arrays. If so, what are my options, or alternatives for the string arrays?

You don't have any string arrays. You have uselessly pissed away memory using arrays of Strings.

There is NO reason to make the data into Strings, when they could be strings.

Change ALL the String keywords to char *.

vaclac and paul - I have changed the String keyword to char*, verified, and it’s ok.
However, uploading still fails.

Binary sketch size: 25,408 bytes (of a 258,048 byte maximum)
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_command(): failed miserably to execute command 0x13
avrdude: stk500v2_paged_write: write command failed
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout

Hmmm…

up!!!!!!

up!!!!!!

up yours 8)

Start with commenting out all the char arrays. If that uploads, uncomment one set a time. Get rid of the one(s) that cause the failure to upload.

The Mega doesn't like hex files created from code that contains "!!!". While I didn't see that particular string in your code, there are places where you have "!!" (uselessly - one ! is more than enough).

In line 93 or so of the Try.ino file, in

String level5[10]

you have "Hi! According to the system, water is at 5 feet!!!"

older versions of the Mega2560 and most clones of the same hang on the triple exclamation point.

There is a revised bootloader available, but the simplest solution is avoiding "!!!"

Marsha

Wow Paul and Marshaj847, you are suggesting the same thing. Perhaps you are correct, I can't wait to try that out later. :) I'll let you know if that works. Meanwhile, someone from Adafruit forum suggested to use Progmem, do you think that the SRAM of my genuine mega is not enough to handle those array of strings?

Glenn

UPDATE: IT WORKS NOW! WOOO! :) You are both correct about the triple exclamation mark. Thank you so much!