Arduino Mega+ethernet shield sd-karte auslesen?

Hallo,
ich hatte auch Probleme mit dieser Konfiguration. Ich habe dann durch vieles Probieren folgendes Setup gefunden
das auf meinem Arduino Mega 2560 mit Ethernet-Shield und SD-Card funktioniert:

#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUDP.h>
#include <Dns.h>
#include <SD.h>
.
.
.
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
unsigned int localPort = 8888;               // local port to listen for UDP packets
.
.
.
// Initialize the Ethernet client library
// with the IP address and port of the server 
// that you want to connect to (port 80 is default for HTTP):
EthernetServer server(80);

.
.
.

// A UDP instance to let us send and receive packets over UDP
EthernetUDP Udp;
DNSClient Dns;


// On the Ethernet Shield, CS is pin 4. Note that even if it's not
// used as the CS pin, the hardware CS pin (10 on most Arduino boards,
// 53 on the Mega) must be left as an output or the SD library
// functions will not work.
const int chipSelect = 4;


void setup() {


  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ;   // wait for serial port to connect. Needed for Leonardo only
  }
  Serial.println("Start setup");

  // make sure that the default chip select pin is set to
  // output, even if you don't use it:
  pinMode(10, OUTPUT);
  digitalWrite(10, HIGH);
  
  Serial.print("Initializing SD card...");
 
  // see if SD card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
  }else {
    Serial.println("card initialized.");
  }
  
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
  }
  
  // give the Ethernet shield a second to initialize:
  delay(1000);
  
  Udp.begin(localPort);
  Dns.begin(Ethernet.dnsServerIP() );

  Serial.println("waiting for sync");
  setSyncProvider(getNtpTime);
  while(timeStatus()== timeNotSet)
     ; // wait until the time is set by the sync provider
  digitalClockDisplay();
  
  server.begin();
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());
  Serial.println("End setup");
}

Da sind auch noch ein paar Zeilen aus meinem "Produktiv-Sketch" drinnen, die kannst du ja ignorieren.
Ich weiss auch nicht warum es auf dem Mega (!!) mit genau diesen Werten geht aber es tut es definitiv.

Gruss
Jürgen