INFO: Dieses Forum nutzt Cookies...
Cookies sind für den Betrieb des Forums unverzichtbar. Mit der Nutzung des Forums erklärst Du dich damit einverstanden, dass wir Cookies verwenden.

Es wird in jedem Fall ein Cookie gesetzt um diesen Hinweis nicht mehr zu erhalten. Desweiteren setzen wir Google Adsense und Google Analytics ein.

Antwort schreiben 
 
Themabewertung:
  • 0 Bewertungen - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Ethernet-WebServer: Button-Belegung
07.06.2015, 15:26 (Dieser Beitrag wurde zuletzt bearbeitet: 07.06.2015 15:27 von 4711engel.)
Beitrag #25
RE: Ethernet-WebServer: Button-Belegung
server is at 192.168.178.45
Initializing SD card...
SUCCESS - SD card initialized.
SUCCESS - Found index.htm file.
GET / HTTP/1.1
Host: 4711engel.ddns.net
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cache-Control: max-age=0

290

Code:
/*--------------------------------------------------------------
          Arduino Ethernet Camera
Take a picture using the adafruit_vc0706 , save it on SD-Card
and print it over ethernet on a internet browser
                  Ulrich Engel
  CoAuthor:       W.A. Smith, http://startingelectronics.org
--------------------------------------------------------------*/

#include <SPI.h>
#include <Ethernet.h>
#include <SD.h>
#include <Adafruit_VC0706.h>
#include <SoftwareSerial.h>  

// size of buffer used to capture HTTP requests
#define REQ_BUF_SZ   20
#define chipSelect 4

// MAC address from Ethernet shield sticker under board
byte mac[] = {0x90, 0xA2, 0xDA, 0x0F, 0x1E, 0x28};
IPAddress ip(192, 168, 178, 45); // IP address, may need to change depending on network
byte gateway[] = { 192, 168, 178, 1 };
byte subnet[] = { 255, 255, 255, 0 };
EthernetServer server(80);  // create a server at port 80
File webFile;
char HTTP_req[REQ_BUF_SZ] = {0}; // buffered HTTP request stored as null terminated string
char req_index = 0;              // index into HTTP_req buffer


SoftwareSerial cameraconnection = SoftwareSerial(2, 3);
Adafruit_VC0706 cam = Adafruit_VC0706(&cameraconnection);

//*************************** void setup ********************************

void setup()
{
    // disable Ethernet chip
    pinMode(10, OUTPUT);
    digitalWrite(10, HIGH);
    
// Open serial communications:
  Serial.begin(9600);

// start the Ethernet connection and the server:
  Ethernet.begin(mac, ip, gateway, subnet);
  server.begin();

  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());  

    
    // initialize SD card
    Serial.println("Initializing SD card...");
    if (!SD.begin(4)) {
        Serial.println("ERROR - SD card initialization failed!");
        return;    // init failed
    }
    Serial.println("SUCCESS - SD card initialized.");
    // check for index.htm file
    if (!SD.exists("index.htm")) {
        Serial.println("ERROR - Can't find index.htm file!");
        return;  // can't find index file
    }
    Serial.println("SUCCESS - Found index.htm file.");
    
}

// **************  void loop  ***********************

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
                // buffer first part of HTTP request in HTTP_req array (string)
                // leave last element in array as 0 to null terminate string (REQ_BUF_SZ - 1)

               if (req_index < (REQ_BUF_SZ - 1)) {
                    HTTP_req[req_index] = c;          // save HTTP request character
                    req_index++;
                }

                // print HTTP request character to serial monitor
                Serial.print(c);
                // last line of client request is blank and ends with \n
                // respond to client only after last line received
                if (c == '\n' && currentLineIsBlank) {
                    // open requested web page file
                    if (StrContains(HTTP_req, "GET / ")
                                 || StrContains(HTTP_req, "GET /index.htm")) {
Serial.println(freeRam());
            
                                   client.println("HTTP/1.1 200 OK");
                        client.println("Content-Type: text/html");
                        client.println("Connnection: close");
                        client.println();
                        webFile = SD.open("index.htm");        // open web page file
                    }

                    if (StrContains(HTTP_req, "GET /IMAGE.JPG")) {
                        webFile = SD.open("IMAGE.JPG");
                        if (webFile) {
                            client.println("HTTP/1.1 200 OK");
                            client.println();
                        }
                    }
          
          
          
               if (StrContains(HTTP_req, "GET /TakingPicture")) {
                              client.println("HTTP/1.1 200 OK");
                              client.println("Content-Type: text/html");
                             client.println("Connnection: close");
                             client.println();  
                        
                          Serial.println("Button -Take a Picture- pressed!");                        

  
                            
                          Serial.println("VC0706 Camera snapshot test");
                          Serial.println("");

/*                      
                              // Try to locate the camera
                             if (cam.begin()) {
                                 Serial.println("Camera Found:");
                              } else {
                                 Serial.println("No camera found?");
                                 return;
                               }

                               // Existing image remove
                         //      SD.remove("IMAGE.JPG");

                               // Set the picture size - you can choose one of 640x480, 320x240 or 160x120
                                  //cam.setImageSize(VC0706_640x480);        // biggest
                                  cam.setImageSize(VC0706_320x240);        // medium
                                  //cam.setImageSize(VC0706_160x120);          // small

                               // You can read the size back from the camera (optional, but maybe useful?)
                                  uint8_t imgsize = cam.getImageSize();
                                  if (imgsize == VC0706_640x480) Serial.println("640x480");
                                  if (imgsize == VC0706_320x240) Serial.println("320x240");
                                  if (imgsize == VC0706_160x120) Serial.println("160x120");

                                  Serial.println("Snap in 3 secs...");
                                    delay(3000);

                                   if (! cam.takePicture())
                                       Serial.println("Failed to snap!");
                                    else
                                       Serial.println("Picture taken!");
  
                                    // Create an image with the name IMAGE.JPG
                                       char filename[10];
                                       strcpy(filename, "IMAGE.JPG");
                                    // Open the file for writing
                                       File imgFile = SD.open(filename, FILE_WRITE);

                                    // Get the size of the image (frame) taken  
                                       uint16_t jpglen = cam.frameLength();
                                       Serial.print("Storing ");
                                       Serial.print(jpglen, DEC);
                                       Serial.print(" byte image.");

                                       int32_t time = millis();
                                       pinMode(4, OUTPUT);
                                       // Read all the data up to # bytes!
                                       byte wCount = 0; // For counting # of writes
                                     while (jpglen > 0) {
                                       // read 32 bytes at a time;
                                       uint8_t *buffer;
                                       uint8_t bytesToRead = min(32, jpglen); // change 32 to 64 for a speedup but may not work with all setups!
                                       buffer = cam.readPicture(bytesToRead);
                                       imgFile.write(buffer, bytesToRead);
                                       jpglen -= bytesToRead;
                                      }
                                       imgFile.close();
                                       time = millis() - time;
                                       Serial.println("done!");
                                       Serial.print(time); Serial.println(" ms elapsed");
                        
                                      webFile = SD.open("index.htm");       // open web page file
  */                                    
                                   }
        
      
          
                    if (webFile) {
                        while(webFile.available()) {
                            client.write(webFile.read()); // send web page to client
                        }
                        webFile.close();
                    }
                    
                    // reset buffer index and all buffer elements to 0
                    req_index = 0;
                    StrClear(HTTP_req, REQ_BUF_SZ);
                    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)
}

/**********************StrClear *********************/

// sets every element of str to 0 (clears array)
void StrClear(char *str, char length)
{
    for (int i = 0; i < length; i++) {
        str[i] = 0;
    }
}

/**********************StrContains *********************/

// searches for the string sfind in the string str
// returns 1 if string found
// returns 0 if string not found
char StrContains(char *str, char *sfind)
{
    char found = 0;
    char index = 0;
    char len;

    len = strlen(str);
    
    if (strlen(sfind) > len) {
        return 0;
    }
    while (index < len) {
        if (str[index] == sfind[found]) {
            found++;
            if (strlen(sfind) == found) {
                return 1;
            }
        }
        else {
            found = 0;
        }
        index++;
    }

    return 0;
}




// *********************
int freeRam ()
{
  extern int __heap_start, *__brkval;
  int v;
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
};
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
07.06.2015, 15:32
Beitrag #26
RE: Ethernet-WebServer: Button-Belegung
Hi,
also noch 290 Byte frei. Das ist eigentlich gar nicht sooo wenig, aber üppig ist es auch nicht gerade. Könntest Du mal folgendes probieren:
Statt
Code:
Serial.println("VC0706 Camera snapshot test");
Serial.println("");
Das hier schreiben:
Code:
Serial.println(F("VC0706 Camera snapshot test"));
Serial.println();
...und außerdem ein paar Mal refresh drücken. Ändert sich dadurch die Ausgabe von freeRam()?

Falls ich mit einer Antwort helfen konnte, wuerde ich mich freuen, ein paar Fotos oder auch ein kleines Filmchen des zugehoerigen Projekts zu sehen.
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
07.06.2015, 15:37 (Dieser Beitrag wurde zuletzt bearbeitet: 07.06.2015 15:39 von 4711engel.)
Beitrag #27
RE: Ethernet-WebServer: Button-Belegung
Jetzt werden diese beiden Zeilen auch ausgegeben.

Code:
Code:
/*--------------------------------------------------------------
          Arduino Ethernet Camera
Take a picture using the adafruit_vc0706 , save it on SD-Card
and print it over ethernet on a internet browser
                  Ulrich Engel
  CoAuthor:       W.A. Smith, http://startingelectronics.org
--------------------------------------------------------------*/

#include <SPI.h>
#include <Ethernet.h>
#include <SD.h>
#include <Adafruit_VC0706.h>
#include <SoftwareSerial.h>  

// size of buffer used to capture HTTP requests
#define REQ_BUF_SZ   20
#define chipSelect 4

// MAC address from Ethernet shield sticker under board
byte mac[] = {0x90, 0xA2, 0xDA, 0x0F, 0x1E, 0x28};
IPAddress ip(192, 168, 178, 45); // IP address, may need to change depending on network
byte gateway[] = { 192, 168, 178, 1 };
byte subnet[] = { 255, 255, 255, 0 };
EthernetServer server(80);  // create a server at port 80
File webFile;
char HTTP_req[REQ_BUF_SZ] = {0}; // buffered HTTP request stored as null terminated string
char req_index = 0;              // index into HTTP_req buffer


SoftwareSerial cameraconnection = SoftwareSerial(2, 3);
Adafruit_VC0706 cam = Adafruit_VC0706(&cameraconnection);

//*************************** void setup ********************************

void setup()
{
    // disable Ethernet chip
    pinMode(10, OUTPUT);
    digitalWrite(10, HIGH);
    
// Open serial communications:
  Serial.begin(9600);

// start the Ethernet connection and the server:
  Ethernet.begin(mac, ip, gateway, subnet);
  server.begin();

  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());  

    
    // initialize SD card
    Serial.println("Initializing SD card...");
    if (!SD.begin(4)) {
        Serial.println("ERROR - SD card initialization failed!");
        return;    // init failed
    }
    Serial.println("SUCCESS - SD card initialized.");
    // check for index.htm file
    if (!SD.exists("index.htm")) {
        Serial.println("ERROR - Can't find index.htm file!");
        return;  // can't find index file
    }
    Serial.println("SUCCESS - Found index.htm file.");
    
}

// **************  void loop  ***********************

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
                // buffer first part of HTTP request in HTTP_req array (string)
                // leave last element in array as 0 to null terminate string (REQ_BUF_SZ - 1)

               if (req_index < (REQ_BUF_SZ - 1)) {
                    HTTP_req[req_index] = c;          // save HTTP request character
                    req_index++;
                }

                // print HTTP request character to serial monitor
                Serial.print(c);
                // last line of client request is blank and ends with \n
                // respond to client only after last line received
                if (c == '\n' && currentLineIsBlank) {
                    // open requested web page file
                    if (StrContains(HTTP_req, "GET / ")
                                 || StrContains(HTTP_req, "GET /index.htm")) {
Serial.println(freeRam());
            
                                   client.println("HTTP/1.1 200 OK");
                        client.println("Content-Type: text/html");
                        client.println("Connnection: close");
                        client.println();
                        webFile = SD.open("index.htm");        // open web page file
                    }

                    if (StrContains(HTTP_req, "GET /IMAGE.JPG")) {
                        webFile = SD.open("IMAGE.JPG");
                        if (webFile) {
                            client.println("HTTP/1.1 200 OK");
                            client.println();
                        }
                    }
          
          
          
               if (StrContains(HTTP_req, "GET /TakingPicture")) {
                              client.println("HTTP/1.1 200 OK");
                              client.println("Content-Type: text/html");
                             client.println("Connnection: close");
                             client.println();  
                        
                          Serial.println("Button -Take a Picture- pressed!");                        

  
                            
Serial.println(F("VC0706 Camera snapshot test"));
Serial.println();

/*                      
                              // Try to locate the camera
                             if (cam.begin()) {
                                 Serial.println("Camera Found:");
                              } else {
                                 Serial.println("No camera found?");
                                 return;
                               }

                               // Existing image remove
                         //      SD.remove("IMAGE.JPG");

                               // Set the picture size - you can choose one of 640x480, 320x240 or 160x120
                                  //cam.setImageSize(VC0706_640x480);        // biggest
                                  cam.setImageSize(VC0706_320x240);        // medium
                                  //cam.setImageSize(VC0706_160x120);          // small

                               // You can read the size back from the camera (optional, but maybe useful?)
                                  uint8_t imgsize = cam.getImageSize();
                                  if (imgsize == VC0706_640x480) Serial.println("640x480");
                                  if (imgsize == VC0706_320x240) Serial.println("320x240");
                                  if (imgsize == VC0706_160x120) Serial.println("160x120");

                                  Serial.println("Snap in 3 secs...");
                                    delay(3000);

                                   if (! cam.takePicture())
                                       Serial.println("Failed to snap!");
                                    else
                                       Serial.println("Picture taken!");
  
                                    // Create an image with the name IMAGE.JPG
                                       char filename[10];
                                       strcpy(filename, "IMAGE.JPG");
                                    // Open the file for writing
                                       File imgFile = SD.open(filename, FILE_WRITE);

                                    // Get the size of the image (frame) taken  
                                       uint16_t jpglen = cam.frameLength();
                                       Serial.print("Storing ");
                                       Serial.print(jpglen, DEC);
                                       Serial.print(" byte image.");

                                       int32_t time = millis();
                                       pinMode(4, OUTPUT);
                                       // Read all the data up to # bytes!
                                       byte wCount = 0; // For counting # of writes
                                     while (jpglen > 0) {
                                       // read 32 bytes at a time;
                                       uint8_t *buffer;
                                       uint8_t bytesToRead = min(32, jpglen); // change 32 to 64 for a speedup but may not work with all setups!
                                       buffer = cam.readPicture(bytesToRead);
                                       imgFile.write(buffer, bytesToRead);
                                       jpglen -= bytesToRead;
                                      }
                                       imgFile.close();
                                       time = millis() - time;
                                       Serial.println("done!");
                                       Serial.print(time); Serial.println(" ms elapsed");
                        
                                      webFile = SD.open("index.htm");       // open web page file
  */                                    
                                   }
        
      
          
                    if (webFile) {
                        while(webFile.available()) {
                            client.write(webFile.read()); // send web page to client
                        }
                        webFile.close();
                    }
                    
                    // reset buffer index and all buffer elements to 0
                    req_index = 0;
                    StrClear(HTTP_req, REQ_BUF_SZ);
                    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)
}

/**********************StrClear *********************/

// sets every element of str to 0 (clears array)
void StrClear(char *str, char length)
{
    for (int i = 0; i < length; i++) {
        str[i] = 0;
    }
}

/**********************StrContains *********************/

// searches for the string sfind in the string str
// returns 1 if string found
// returns 0 if string not found
char StrContains(char *str, char *sfind)
{
    char found = 0;
    char index = 0;
    char len;

    len = strlen(str);
    
    if (strlen(sfind) > len) {
        return 0;
    }
    while (index < len) {
        if (str[index] == sfind[found]) {
            found++;
            if (strlen(sfind) == found) {
                return 1;
            }
        }
        else {
            found = 0;
        }
        index++;
    }

    return 0;
}




// *********************
int freeRam ()
{
  extern int __heap_start, *__brkval;
  int v;
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
};




Serial monitor:

server is at 192.168.178.45
Initializing SD card...
SUCCESS - SD card initialized.
SUCCESS - Found index.htm file.
GET / HTTP/1.1
Host: 4711engel.ddns.net
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cache-Control: max-age=0

318
GET /IMAGE.JPG HTTP/1.1
Host: 4711engel.ddns.net
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://4711engel.ddns.net/
Connection: keep-alive

Ich meinte,
mit "F" wird die Webpage trotz der beiden zusätzlichen Zeilen im Browser angezeigt.

Was bedeutet das "F"?
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
07.06.2015, 15:41
Beitrag #28
RE: Ethernet-WebServer: Button-Belegung
Du hast da definitiv ein Speicherplatzproblem. Hier zum F: http://playground.arduino.cc/Learning/Memory.

Falls ich mit einer Antwort helfen konnte, wuerde ich mich freuen, ein paar Fotos oder auch ein kleines Filmchen des zugehoerigen Projekts zu sehen.
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
07.06.2015, 15:46
Beitrag #29
RE: Ethernet-WebServer: Button-Belegung
D.H.
sollte ich auf einen MEGA umsteigen?
Das ethernet board sucht sich doch selber die SPI-PINs.
Ich muss dann aber den sketch anpassen.

Bleibt der chipSelect auf 4?
Muss ich noch andere ändern?
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
07.06.2015, 15:46
Beitrag #30
RE: Ethernet-WebServer: Button-Belegung
So, jetzt geht es darum, Speicherplatz einzusparen. Möglicherweise ist der Uno zu "klein" für die Anforderung, aber das ist noch nicht klar.
Dazu müssten jetzt mehrere Sachen getan werden, aber Du scheinst immer nur mit einer Sache auf einmal zurecht zu kommen. Daher erstmal nur das:
Könntest Du mal im Browser ein paar Mal Refresh drücken und die zugehörige Ausgabe hier reinstellen?

Falls ich mit einer Antwort helfen konnte, wuerde ich mich freuen, ein paar Fotos oder auch ein kleines Filmchen des zugehoerigen Projekts zu sehen.
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
07.06.2015, 15:49
Beitrag #31
RE: Ethernet-WebServer: Button-Belegung
Du scheinst kleine spitze Bemerkungen zu lieben.


Hier die Refreshes wie sie im serial monitor erscheinen:

Code:
server is at 192.168.178.45
Initializing SD card...
SUCCESS - SD card initialized.
SUCCESS - Found index.htm file.
GET / HTTP/1.1
Host: 4711engel.ddns.net
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cache-Control: max-age=0

318
GET /IMAGE.JPG HTTP/1.1
Host: 4711engel.ddns.net
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://4711engel.ddns.net/
Connection: keep-alive
Cache-Control: max-age=0

GET / HTTP/1.1
Host: 4711engel.ddns.net
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cache-Control: max-age=0

318
GET /IMAGE.JPG HTTP/1.1
Host: 4711engel.ddns.net
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://4711engel.ddns.net/
Connection: keep-alive
Cache-Control: max-age=0

GET / HTTP/1.1
Host: 4711engel.ddns.net
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cache-Control: max-age=0

318
GET /IMAGE.JPG HTTP/1.1
Host: 4711engel.ddns.net
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://4711engel.ddns.net/
Connection: keep-alive
Cache-Control: max-age=0

GET / HTTP/1.1
Host: 4711engel.ddns.net
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cache-Control: max-age=0

318
GET /IMAGE.JPG HTTP/1.1
Host: 4711engel.ddns.net
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://4711engel.ddns.net/
Connection: keep-alive
Cache-Control: max-age=0

GET / HTTP/1.1
Host: 4711engel.ddns.net
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cache-Control: max-age=0

318
GET /IMAGE.JPG HTTP/1.1
Host: 4711engel.ddns.net
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://4711engel.ddns.net/
Connection: keep-alive
Cache-Control: max-age=0


Diesmal ohne Code.
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
07.06.2015, 16:00
Beitrag #32
RE: Ethernet-WebServer: Button-Belegung
Hi,
ok, jetzt wissen wir, dass da zumindest kein Memory Leak zuschlägt. Der freie Platz bleibt bei 318.
Das mit dem Mega könnte helfen, aber Du musst nicht so schnell aufgeben. Mach mal folgendes:
1. Prüfe alle Serial.print (und ähnliches), die eine feste Zeichenkette ausgeben, ob Du sie wirklich brauchst. Wenn nicht, dann weg damit.
2. Bei denen, die Du nicht rauswerfen willst, kürze die Zeichenkette auf das, was wirklich benötigt wird. Z.B.:
Code:
Serial.println("ERROR - SD card initialization failed!");

...braucht 39 Byte Speicherplatz. Mach das draus:
Code:
Serial.println(F("E01"));
Das braucht vier Byte und zwar im Flash.
Mach Dir dazu eine Textdatei, die die Nummern erklärt.
3. Das hier...
Code:
client.println("HTTP/1.1 200 OK");
                         client.println("Content-Type: text/html");
                         client.println("Connnection: close");
...gibt es mindestens zweimal. Das geht sowohl auf's Flash als auch auf's SRAM. Mach da eine Funktion draus und ruf diese auf, wenn sie gebraucht wird. Falls was unklar ist könnte das hier helfen: http://www.arduino.cc/en/pmwiki.php?n=Re...eclaration

Das sollte jetzt erstmal reichen. Es gibt noch mehr Möglichkeiten, aber das könnte schon genug sein, um das Teil zum Fliegen zu bringen.

Gruß,
Thorsten

Falls ich mit einer Antwort helfen konnte, wuerde ich mich freuen, ein paar Fotos oder auch ein kleines Filmchen des zugehoerigen Projekts zu sehen.
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
Antwort schreiben 


Möglicherweise verwandte Themen...
Thema: Verfasser Antworten: Ansichten: Letzter Beitrag
  Arduino UNO und Ethernet Shield 2 POE und Fritzbox 3272 tr3 2 145 19.11.2016 10:46
Letzter Beitrag: tr3
  ESP8266 ESP12-E Webserver-Frage Claus_M 8 231 14.11.2016 22:02
Letzter Beitrag: Claus_M
  Webserver + Bild als Hintergrund ?! Marc2014 8 243 11.10.2016 21:39
Letzter Beitrag: Bitklopfer
  Ethernet Modul Enc28j60 Pin13 LED Schalten BennIY 16 489 27.09.2016 20:30
Letzter Beitrag: BennIY
  ESP8266 Webserver Programmieren HDT 11 747 23.08.2016 13:28
Letzter Beitrag: HDT
  Hilfe gesucht. Webserver Statsiche und Dynamische HTMl Seite b3ta 11 447 22.08.2016 08:07
Letzter Beitrag: b3ta
  ESP8266 Webserver Marc2014 0 343 30.07.2016 20:15
Letzter Beitrag: Marc2014
Question Webserver, Client, Loop Marc2014 6 361 29.07.2016 21:04
Letzter Beitrag: Marc2014
Sad Die Grafik Kontakt/Pin Belegung ATtiny 85 malsehen 3 257 15.07.2016 19:31
Letzter Beitrag: hotsystems
  Frage zu One Button in Kombination mit Fast LED Wolfgang_2801 3 237 26.06.2016 22:11
Letzter Beitrag: hotsystems

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste