ENC28j60 + Mega 2560 + 16 Relays + shiftout => Maximum Number of "$F"-Statments?

Hi all,

i spent my complete saturday trying to get everything together and working. I can add 15 of my relays into the web gui - if i add my 16th, the webserver crashes (loadin untik death) this seems to be the problematic part:

“Relay 1: <div id=‘p1’ onclick=“firePage(1)”>$F "
“Relay 2: <div id=‘p2’ onclick=“firePage(2)”>$F "
“Relay 3: <div id=‘p3’ onclick=“firePage(3)”>$F "
“Relay 4: <div id=‘p4’ onclick=“firePage(4)”>$F "
“Relay 5: <div id=‘p5’ onclick=“firePage(5)”>$F "
“Relay 6: <div id=‘p6’ onclick=“firePage(6)”>$F "
“Relay 7: <div id=‘p7’ onclick=“firePage(7)”>$F "
“Relay 8: <div id=‘p8’ onclick=“firePage(8)”>$F "
“Relay 1: <div id=‘p9’ onclick=“firePage(9)”>$F "
“Relay 2: <div id=‘p10’ onclick=“firePage(10)”>$F "
“Relay 2: <div id=‘p11’ onclick=“firePage(11)”>$F "
“Relay 2: <div id=‘p12’ onclick=“firePage(12)”>$F "
“Relay 2: <div id=‘p13’ onclick=“firePage(13)”>$F "
“Relay 14: <div id=‘p14’ onclick=“firePage(14)”>$F "
“Relay 15: <div id=‘p15’ onclick=“firePage(15)”>$F "
“Relay 16: <div id=‘p16’ onclick=“firePage(16)”>$F " // ← all working without the 16h
“\r\n”
“\r\n”),
PinStatus[1]?PSTR(“1”):PSTR(“0”),
PinStatus[2]?PSTR(“1”):PSTR(“0”),
PinStatus[3]?PSTR(“1”):PSTR(“0”),
PinStatus[4]?PSTR(“1”):PSTR(“0”),
PinStatus[5]?PSTR(“1”):PSTR(“0”),
PinStatus[6]?PSTR(“1”):PSTR(“0”),
PinStatus[7]?PSTR(“1”):PSTR(“0”),
PinStatus[8]?PSTR(“1”):PSTR(“0”),
PinStatus[9]?PSTR(“1”):PSTR(“0”),
PinStatus[10]?PSTR(“1”):PSTR(“0”),
PinStatus[11]?PSTR(“1”):PSTR(“0”),
PinStatus[12]?PSTR(“1”):PSTR(“0”),
PinStatus[13]?PSTR(“1”):PSTR(“0”),
PinStatus[14]?PSTR(“1”):PSTR(“0”),
PinStatus[15]?PSTR(“1”):PSTR(“0”),
PinStatus[16]?PSTR(“1”):PSTR(“0”), // ← all working without the 16h
PinStatus[1]?PSTR(”-”):PSTR(”+”),
PinStatus[2]?PSTR(”-”):PSTR(”+”),
PinStatus[3]?PSTR(”-”):PSTR(”+”),
PinStatus[4]?PSTR(”-”):PSTR(”+”),
PinStatus[5]?PSTR("-"):PSTR("+"),
PinStatus[6]?PSTR("-"):PSTR("+"),
PinStatus[7]?PSTR("-"):PSTR("+"),
PinStatus[8]?PSTR("-"):PSTR("+"),
PinStatus[9]?PSTR("-"):PSTR("+"),
PinStatus[10]?PSTR("-"):PSTR("+"),
PinStatus[11]?PSTR("-"):PSTR("+"),
PinStatus[12]?PSTR("-"):PSTR("+"),
PinStatus[13]?PSTR("-"):PSTR("+"),
PinStatus[14]?PSTR("-"):PSTR("+"),
PinStatus[15]?PSTR("-"):PSTR("+"),
PinStatus[16]?PSTR("-"):PSTR("+")); // ← all working without the 16h
}

i tried to find a solution in the forum or in google - but no change… :S attached is also my sketch. im a newbie, so pleasebe patient with me. i hope someone can help me.

thanks, mike.

sketch_rel2.ino (10.9 KB)

byte Ethernet::buffer[5000]; // tcp/ip send and receive buffer

On which Arduino?

arduino mega 2560 - an the "first bunch if $F" is going into javascript variables...

"var pin1 = $F; " "var pin2 = $F; " "var pin3 = $F; " "var pin4 = $F; " "var pin5 = $F; " "var pin6 = $F; " "var pin7 = $F; " "var pin8 = $F; " "var pin9 = $F; " "var pin10 = $F; " "var pin11 = $F; " "var pin12 = $F; " "var pin13 = $F; " "var pin14 = $F; " "var pin15 = $F; " "var pin16 = $F; "

=> 30 x $F all is fine...32 x $F => load to death... but i still can ping the arduino webserver

You are using 60% percent of SRAM for a ridiculously large array. Why would you be sending a novel to the Arduino?

because im new - i have to learn. the large dataamount is not the problem at the moment.. the problem is, that it seems i cannot use 32 $F-placeholders.

if you can teach me a little, perhaps i dont need them...

the large dataamount is not the problem at the moment.. the problem is, that it seems i cannot use 32 $F-placeholders.

The large data amount IS the problem. You have room in SRAM for lots of string literals OR the oversize array. Not both.

Thanks, but the ide says there is still 30% ram free - thought this will be allocated?

Mike.

Thanks, but the ide says there is still 30% ram free - thought this will be allocated?

Just for shits and giggles, and to stop wasting my time, make the damned array smaller and see what happens.

What you are doing is printing 16 sentences that are so similar that you should use a loop to generate. Print something, print number, print more, then that same number,etc. That's what you should do in your case, not complete sentences with one print. Read about for loop.

Curious, what is your $F? You called it a place holder. Will all of them be replaced by the same thing that JavaScript decides?