[Solved] TCP/IP direction to a bigger package

I am modifying the web server program that came in the arduino library.The code I've written so far is only 14,840 bytes. The Unos memory can hold 32,256 bytes though. The problem I am having is I've reached a point where anymore code causes the Serial Monitor to say "please update Wi-Fi firmware" even though it has clearly been upgraded. If I // parts of the code I can add more code without this happening, and the use of booleans seems to be the main culprit. The only thing worse than booleans, is if I try to make the code "cleaner" by compacting it like

client.print(" PinSwitch responded
"); instead of

client.print(" PinSwitch responded ");
client.print("
");

I am completely new to programming, but I have watched a few youtube videos on TCP/IP protocols. To my understanding, its basically the same process as mailing a letter. You have to put a stamp on the letter, write who it is to, and who sent it, put it in an packet then put several packets into an envelope or mailbox whichever is considered more appropriate, then the mailman transports the envelope etc.

I just don't know where to start the De-bugging process. Do I need a bigger envelope, a bigger package to hold the envelopes, or a bigger/more mailmen..... and how do I address that? Being new to programming, I don't know even know what to search for. Is this an issue that I have maxed out the limited 2 KB SRAM (scratchpad/working memory)? Does the F macro work like using FedEx and UPS?

I feel somewhat confident in understanding the basics of the code I've written. However, it isn't clear how to assign bigger packets, or bigger/more mailmen. Youtube hasn't been very helpful.... probably in part because I don't know how to word what I need to search for.

Any suggestions, wording, or information on how to research TCP/IP protocols using the arduino will be extremely appreciated. Or if this doesn't have to do with TCP?IP protocols, any guidance will still be appreciated!

I am completely new to programming

But you are approaching it as if you have terabytes of memory. You do not!

client.print(F(" PinSwitch responded
"));
Keep the string literals out of SRAM.

I just don't know where to start

Sure you do. You start here. But, with your code, not without it.

An example of using the F() macro with a lot of static html code to save memory.

//double quote " in html replaced with a single quote' to prevent compile error
//html lines consolidated and put inside F() macro to save memory space

client.print(F("<html><head><meta http-equiv='Content-Language' content='pt-br'>"
"<meta http-equiv='Content-Type' content='text/html; charset=windows-1252'>"
"<title>Unirp - Centro Universitário de Rio Preto</title></head><body>"
"<div align='center'><h1>Centro Universitario de Rio Preto</h1>"
"<h2>Gerenciamento de Volume e Temperatura da Banheira</h2></div>"
"<div align='center'><h4> Pressione o Botão para encher na temperatura desejada</h4>"
"<table border='0' width='50%' cellpadding='2'><tr></tr><tr><td>"
"<!--Botão Temperatura Fria--><form method='POST' action='arduino.php'>"
"<p align='center'><input type='hidden' value='fria' name='tempD' >"
"<input type='submit' value='Água Fria' name='fria'></p></form>"
"<!--Botão Temperatura Morna--><form method='POST' action='arduino.php'>"
"<p align='center'><input type='hidden' value='morna' name='tempD' >"
"<input type='submit' value='Água Morna' name='morna'></p></form>"
"<!--Botão Temperatura Quente--><form method='POST' action='arduino.php'>"
"<p align='center'><input type='hidden' value='quente' name='tempD' >"
"<input type='submit' value='Água Quente' name='quente'></p></form></form>"
"<div align='center'></div></tr></table></div></body></html>"));

Does the F macro work like using FedEx and UPS?

Whoa. No.

How to use this forum

Nick Gammon,

It's a pleasure to receive a response from the legion! I just signed up three days ago, but your articles on the forum have by far been extremely helpful and easy to understand.

It was actually in one of your forum post that I first encountered the suggestion of using F macro. You said it was unfortunate that you could search the entire Arduino database and not find one reference to it, though it was one of the most powerful functions. I am trying to understand how everything works.

I am still learning, but I don't understand why you can't use clean code like

client.print(" PinSwitch responded
"); instead of

client.print(" PinSwitch responded ");
client.print("
");

The ("
") seems to act as the same function as in in Serial.println where it starts a new line. Why can't a user just add a ln to the end of client.print to start a new line as well? It seems it would make the code much easier to read.

Also, why isn't the code automatically written for ("") to automatically act as if it already included a F macro? It seems that would be desired, then if it didn't have the "" and was only () it wouldn't include the F macro.

Thomas499:
The problem I am having is I've reached a point where anymore code causes the Serial Monitor to say "please update Wi-Fi firmware" even though it has clearly been upgraded.

Obviously it hasn't been upgraded. You wouldn't get that message if you are using IDE v1.0.6 and the firmware is v1.1.0.

Use the F() function to save SRAM.

// Change print calls like this
client.print(" PinSwitch responded 
 "); 
// to this
client.print(F(" PinSwitch responded 
 "));

Thanks guys!

For some reason using client.print(F(" PinSwitch responded
")); slowed down the upload to internet process, but by splitting it up using using the example below it works fine and solves the Scratchpad memory issue. Thanks!

client.print(F(" PinSwitch responded")
client.print(F(
"));