hello, i have a primitive code to just make a server from arduino.
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,243,253);
IPAddress dns(192,168,240,55);
IPAddress subnet(255,255,252,0);
IPAddress gateway(192,168,240,2);
EthernetServer server(80);
void setup()
{
Ethernet.begin(mac, ip, dns, gateway, subnet);
server.begin();
}
void loop()
{
EthernetClient client = server.available(); // try to get client
if (client) { // got client?
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) { // client data available to read
char c = client.read(); // read 1 byte (character) from client
// last line of client request is blank and ends with \n
// respond to client only after last line received
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close");
client.println();
// send web page
client.println("<!DOCTYPE html>");
client.println("<html>");
client.println("<head>");
client.println("<title>Arduino Web Page</title>");
client.println("</head>");
client.println("<body>");
client.println("<h1>CAUKOOO</h1>");
client.println("<p>bavis sa ?</p>");
client.println("</body>");
client.println("</html>");
break;
}
// every line of text received from the client ends with \r\n
if (c == '\n') {
// last character on line of received text
// starting new line with next character read
currentLineIsBlank = true;
}
else if (c != '\r') {
// a text character was received from client
currentLineIsBlank = false;
}
} // end if (client.available())
} // end while (client.connected())
delay(1); // give the web browser time to receive the data
client.stop(); // close the connection
} // end if (client)
}
my question is, can i somehow make two partitions on SD card 2 GB and one partition using on dynamic storing data and the other to just be constant and load from it html page, and maybe some php ...
could this be possible ? i know that code must be compiled and not just put on SD card, but i mean it like this :
#include <SPI.h>
#include <Ethernet.h>
#include <SD.h>
IPAddress ip(192,168,243,253);
//i don't write code to enable sd card and that stuff ...
/*this string will be stored in sd card*/
String loadFromSD[3] = "HTTP/1.1 200 OK","Content-Type: text/html","Connection: close";
/*when client will type static ip address of arduino to the web browser, it will wait for client */
if (client) { // got client?
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read(); // read 1 byte (character) from client
// last line of client request is blank and ends with \n
// respond to client only after last line received
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println(loadFromSD[0]);
client.println(loadFromSD[1]);
client.println(loadFromSD[2]);
...more code for website...
}
could this be possible ?