[SOLVED] Sketch fine on Duemilanove not on Leonardo

I have a sketch as follows, and it works perfectly on my Duemilanove, but I have purchased 3 Leonardo’s and it does not work. I cannot ping or access the HTTP page.

Simple sketches such as Blink work fine.

#include <EtherCard.h>
#include "DHT.h"
#define DHTPIN 6     // what pin we're connected to

// Uncomment whatever type you're using!
//#define DHTTYPE DHT11   // DHT 11 
#define DHTTYPE DHT22   // DHT 22  (AM2302)
//#define DHTTYPE DHT21   // DHT 21 (AM2301)

DHT dht(DHTPIN, DHTTYPE);

// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
static byte myip[] = { 10,155,10,16 };
static byte gwip[] = { 10,155,10,254 };

byte Ethernet::buffer[500];
BufferFiller bfill;

int sensorPin = 3;
int ledPin = 2;

void setup () {
  if (ether.begin(sizeof Ethernet::buffer, mymac, 10) == 0)
    Serial.println( "Failed to access Ethernet controller");
  ether.staticSetup(myip, gwip);
  dht.begin();
  pinMode(sensorPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
}

static word homePage() {
  delay(500);
  digitalWrite(ledPin, HIGH);
  digitalWrite(sensorPin, HIGH);
  delay(1000);
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  digitalWrite(sensorPin, LOW);
  delay(2000);
  digitalWrite(sensorPin, HIGH);
  delay(1000);
  float h2 = dht.readHumidity();
  float t2 = dht.readTemperature();
  digitalWrite(sensorPin, LOW);
  digitalWrite(ledPin, LOW);
  float averageh = (h + h2 ) / 2;
  float averaget = (t + t2 ) / 2;
  int h_dec = (averageh - int(averageh)) * 100;
  int t_dec = (averaget - int(averaget)) * 100;
  bfill = ether.tcpOffset();
  bfill.emit_p(PSTR(
    "HTTP/1.0 200 OK\r\n"
    "Content-Type: text/plain\r\n"
    "Pragma: no-cache\r\n"
    "\r\n"
    "[$D.$D][$D.$D]"),
      int(averageh), h_dec , int(averaget), t_dec);
  
  return bfill.position();
  
}

void loop () {
  digitalWrite(ledPin, HIGH);
  word len = ether.packetReceive();
  word pos = ether.packetLoop(len);

  if (pos)  // check if valid tcp data is received
    ether.httpServerReply(homePage()); // send web page data
    
    
  
    
}

Does Leonardo bring SPI connections to pins 11-12-13 like on a Duemilanove? I think they might be different. Check the Leonardo schematic, add jumpers from the ICSP header to D11-12-13 if needed.

That appears to be the answer. I can't quite figure out which of the 6 pins I need to jumper to the digital pins

Maybe this will help:

Awesome thanks!

I have jumpered the pins and it is now working nicely :)