Maximum length of a client.println() command when building arduino web pages

Hey !

Im currently running a webpage from my arduino mega building from basic web server examples.

My question is im really unsure how much HTML I should be using in each client.pintln() line of code. :fearful:

Heres an example of one of my lines of code

client.println(F("SMTWTFS"));

As your can see its quite long yet has not problems being sent/received and I have MANY of these.

So my question stands, how long can I make each client.println() command? :astonished:

And one other question, what is the difference between client.println() and client.println(F()) ?
The Learning section says the F one reads from flash memory however I was under the impression all code uploaded to the arduino is stored in Flash memory? Im confused! :blush:

Thanks in advance

Jasper

So my question stands, how long can I make each client.println() command?

As long as you want, until it doesn't work. The data is all buffered, so the function will merely block until the data has been buffered.

And one other question, what is the difference between client.println() and client.println(F()) ?

The F() macro generates code to fetch the literal from PROGMEM (flash memory), so the literal is not also stored in SRAM. Without it, the data is copied to SRAM at run time. You don't have a lot of SRAM.

I'd keep the lines as short as possible - at most one html tag, it will be a lot easier to debug

So how big is the buffer then?

I'm re adding my whole web page to my arduino project after re designing it in a proper html editor and I'm and am trying to work out what size chunks I should cut it up into.....for the client.print()

The bigger chunks I can use the better.

In regards to putting one html tags per client.print....

That would make the program way to big with over 500 html tags as it is.
Debugging is not an issue in this case.

Thanks !

The bigger chunks I can use the better.

I'm with you. Every call to client.write(), client.print(), or client.println() is sent in a separate packet. The fewer packets sent, the faster and the less chance of a fail. I use a 64 byte buffer when using the SD with the w5100. I read 64 bytes from the SD file into the byte array, then send that as one 64 byte packet.

I might try and break my new web page down into 64 characters ate time then

Are there any limitations when including java script client side stuff on arduino?

Ill soon find out...

Ill soon find out...

That's the best way to learn.