I've go a code that seems not to work because its to big. First i was only able to use up to 4 relays on my html portal. When i removed some code i was able to gel 5 relays working. Then removed more code able to get 6 relays working, But now i'm at a point that i'm not able to remove any more code to get my project working so i can control all 8 of my relays
the code is fine but the html page loads slower and when i add number 7 buttons on page noting works anymore if i add number 8 page wont even open
i'm using the following hardware:
Arduino UNO Rev. 3
8 channel relays ( 8 kanaals relais )
Ethernetshield rev 3
code size: 16.654 bytes (of the 32.256-byte maximum)
if i disable the last 2 relays my code size is: 15.714 bytes (of the 32.256-byte maximum) no problems
then i add 1 more relay my code size is: 15.896 bytes (of the 32.256-byte maximum) page loads very slow none of my functions work.
or could it be a ram size issue?
Put your html code on the sd card.
I'd move to a mega even a mega clone.
You are probably running out of memory. Without seeing your code it is hard to say. You should use the F() macro for static text strings to save memory. Below is some server test code that uses the F() macro.
// zoomkat's meta refresh data frame test page 8/17/13
// use http://192.168.1.102:84 in your brouser for main page
// http://192.168.1.102:84/data static data page
// http://192.168.1.102:84/datastart meta refresh data page
// for use with W5100 based ethernet shields
// set the refresh rate to 0 for fastest update
// use STOP for single data updates
#include <SPI.h>
#include <Ethernet.h>
const int analogInPin0 = A0;
const int analogInPin1 = A1;
const int analogInPin2 = A2;
const int analogInPin3 = A3;
const int analogInPin4 = A4;
const int analogInPin5 = A5;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 102 }; // arduino ip in lan
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(84); //server port
unsigned long int x=0; //set refresh counter to 0
String readString;
//////////////////////
void setup(){
Serial.begin(9600);
// disable SD SPI if memory card in the uSD slot
pinMode(4,OUTPUT);
digitalWrite(4,HIGH);
Ethernet.begin(mac, ip, gateway, gateway, subnet);
server.begin();
Serial.println(F("meta refresh data frame test 8/17/13")); // so I can keep track of what is loaded
}
void loop(){
EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();
if (readString.length() < 100) {
readString += c;
}
//check if HTTP request has ended
if (c == '\n') {
//check get atring received
Serial.println(readString);
//output HTML data header
//client.println("HTTP/1.1 200 OK");
//client.println("Content-Type: text/html");
//client.println();
client.print(F("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n"));
//generate data page
if(readString.indexOf("data") >0) { //checks for "data" page
x=x+1; //page upload counter
client.print(F("<HTML><HEAD>"));
//meta-refresh page every 1 seconds if "datastart" page
if(readString.indexOf("datastart") >0) client.print(F("<meta http-equiv='refresh' content='1'>"));
//meta-refresh 0 for fast data
if(readString.indexOf("datafast") >0) client.print(F("<meta http-equiv='refresh' content='0'>"));
client.print(F("<title>Zoomkat's meta-refresh test</title></head><BODY>
"));
client.print(F("page refresh number: "));
client.print(x); //current refresh count
client.print(F("
"));
//output the value of each analog input pin
client.print(F("analog input0 is: "));
client.print(analogRead(analogInPin0));
client.print(F("
analog input1 is: "));
client.print(analogRead(analogInPin1));
client.print(F("
analog input2 is: "));
client.print(analogRead(analogInPin2));
client.print(F("
analog input3 is: "));
client.print(analogRead(analogInPin3));
client.print(F("
analog input4 is: "));
client.print(analogRead(analogInPin4));
client.print(F("
analog input5 is: "));
client.print(analogRead(analogInPin5));
client.print(F("
</BODY></HTML>"));
}
//generate main page with iframe
else
{
client.print(F("<HTML><HEAD><TITLE>Zoomkat's frame refresh test</TITLE></HEAD>"
"Zoomkat's Arduino frame meta refresh test 8/17/13"
"
Arduino analog input data frame:
"
" <a href='/datastart' target='DataBox' title=''yy''>META-REFRESH</a>"
" <a href='/data' target='DataBox' title=''xx''>SINGLE-STOP</a>"
" <a href='/datafast' target='DataBox' title=''zz''>FAST-DATA</a>
"
"<iframe src='/data' width='350' height='250' name='DataBox'>"
"</iframe>
</HTML>"));
}
delay(1);
//stopping client
client.stop();
//clearing string for next read
readString="";
}
}
}
}
}
Thanks Zoomkat!! now my code is running good 