hello guys!i m making a simple system that controls 3 relays and 2 sensors via the ethernet shield of my arduino.the problem is that i want to make arduino take the css file which is located in my sd card instead of the internet(as the example code i m modifying suggests).how could i do something like that?if that isnt possible,i also have another idea,of just visiting a starting webpage (index.htm) and then control the sensors.i have found a code that shows the index.htm located to my sd card,but i dont know how to combine it with my code.i m giving you both codes,just to tell me if you have any ideas!!
my code is this one
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 177 }; // ip in lan
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(80); //server port
String readString;
//////////////////////
void setup(){
pinMode(4, OUTPUT);
pinMode(6, OUTPUT); //pin selected to control
//start Ethernet
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();
//the pin for the servo co
//enable serial data print
Serial.begin(9600);
Serial.println("server LED test 1.0"); // so I can keep track of what is loaded
}
void loop(){
// Create a client connection
EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();
//read char by char HTTP request
if (readString.length() < 100) {
//store characters to string
readString += c;
//Serial.print(c);
}
//if HTTP request has ended
if (c == '\n') {
///////////////
Serial.println(readString); //print to serial monitor for debuging
client.println("HTTP/1.1 200 OK"); //send new page
client.println("Content-Type: text/html");
client.println();
client.println("<HTML>");
client.println("<HEAD>");
client.println("<style>");
client.println("<background-color=#525252>");
client.println("<meta name='apple-mobile-web-app-capable' content='yes' />");
client.println("<meta name='apple-mobile-web-app-status-bar-style' content='black-translucent' />");
client.println("<link rel='stylesheet' type='text/css' href='http://homeautocss.net84.net/a.css' />");
client.println("<TITLE><font size=9 color=red>Christmas Lights</font></TITLE>");
client.println("</style>");
client.println("</HEAD>");
client.println("<BODY>");
client.println("<H1><font size=9 color=red>CHRISTMAS LIGHTS</font></H1>");
client.println("
");
client.println("
");
client.println("
");
client.println("
");
client.println("
");
client.println("<H1><font size=9 color=red>TREE-DOOR<font></H1>");
client.println("<a href=\"/?lighton1\"\"><font size=6 color=black>ON</font> </a>");
client.println("<a href=\"/?lightoff1\"\"><font size=6 color=black>OFF</font></a>
");
client.println("
");
client.println("
");
client.println("
");
client.println("<H1><font size=6 color=red>other lights</font></H1>");
client.println("<a href=\"/?lighton2\"\"><font size=6 color=black>ON</font> </a>");
client.println("<a href=\"/?lightoff2\"\"><font size=6 color=black>OFF</font></a>
");
client.println("<hr />");
client.println("</BODY>");
client.println("</HTML>");
delay(1);
//stopping client
client.stop();
///////////////////// control arduino pin
if(readString.indexOf("?lighton1") >0)//checks for on
{
digitalWrite(4, HIGH); // set pin 4 high
Serial.println("Led On");
}
else{
if(readString.indexOf("?lightoff1") >0)//checks for off
{
digitalWrite(4, LOW); // set pin 4 low
Serial.println("Led Off");
}
}
if(readString.indexOf("?lighton2") >0)//checks for on
{
digitalWrite(6, LOW); // set pin 4 high
Serial.println("Led On");
}
else{
if(readString.indexOf("?lightoff2") >0)//checks for off
{
digitalWrite(6, HIGH); // set pin 4 low
Serial.println("Led Off");
}
}
//clearing string for next read
readString="";
}
}
}
}
}
and the code for the index.htm from sd is this one
any help will really be great!!either reading the css from my sd,or just combining the two codes!!