Problem with Ethernet Library and Led

Sorry for my bad English.
I Have a simple code with 1 function.

The function is:

void blinking((int time, int color){
// colore = 1 == Red
// colore = 2 == Yellow
// colore = 3 == Red and Yellow

pinMode(RED, OUTPUT);
pinMode(YELLOW, OUTPUT);

for (int i = 0; i <= quanto; i++) {
switch (colore) {
case 1:
digitalWrite(RED, HIGH);
delay(1000);
digitalWrite(RED, LOW);
break;
case 2:
digitalWrite(YELLOW, HIGH);
delay(1000);
digitalWrite(YELLOW, LOW);
break;
case 3:
digitalWrite(RED, HIGH);
digitalWrite(YELLOW, HIGH);
delay(1000);
digitalWrite(RED, LOW);
digitalWrite(YELLOW, LOW);
break;
default:
break;
// if nothing else matches, do the default
// default is optional
}
delay(1000);
}

This function works without problems until I put in my code these lines and after I recall my function "blinking", it doesn't work, but the call before this code it works

while (FLAG == 0){
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
} else {
FLAG=1;
}
}

Leds don't blink, why? can you help me? =(

Please can you post your whole program and put it in code tags (# above the smileys)
The problem may not actually be in your function at all but without seeing all of your code it is impossible to help.

There are notes in Italian.

#include <SPI.h>
#include <Ethernet.h>
#include <stdlib.h>

// Definisco il Mac Address della scheda che è stampata sullo shield ethernet
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0xAB, 0x50 };
String mac_string="90:A2:DA:0D:AB:50";
String buffer="";
String newbuffer="";
unsigned long nuovo_ip;
int indice1;
int indice2;

// Definisco ip del server su cui cercare info

IPAddress server;         // Default vuoto
IPAddress IPLocale;       // Default vuoto

const int Rosso = 13;           // LED che indica la connessione ethernet
const int Giallo = 12;           // LED che indica la connessione ethernet

int FLAG_Connessione=0;          // Indica se la connessione è avvenuta o meno
int FLAG_Server=0;               // indica che la connsessione con il server [lato dhcp] è avvenuta

EthernetClient client;

void setup() {
  
  // Inizializziamo la seriale
  
  Serial.begin(9600);
  
  // Inizializziamo i LED

  pinMode(Rosso, OUTPUT);
  pinMode(Giallo, OUTPUT);

}

void loop() {
  
  Serial.println("AVVIO PROGRAMMA"); 
  // Iniziamo la connessione DHCP

  Lampeggio(2,3);  // IT'S OK
  
  while (FLAG_Connessione == 0){
        if (Ethernet.begin(mac) == 0) {
            Serial.println("Failed to configure Ethernet using DHCP");
            
            // Connessione non riuscita
            Serial.println("Connessione = 0");
            
        } else {
          
          // Connessione riuscita
          FLAG_Connessione=1;
          Serial.println("Connessione = 1");
        }
    }
  
  Lampeggio(2,2); // IT DOESN'T WORK
    
  // Stampo ip locale ottenuto
  IPLocale=Ethernet.localIP();

  Serial.println(IPLocale);
  
  server[0]=IPLocale[0];
  server[1]=IPLocale[1];
  server[2]=IPLocale[2];


  //
  // Richiesta IP PRIVATO newip.php
  //
  // Devo ciclare su tutti gli ip per cercare il server 
  //
  if (FLAG_Server == 0) {
      for (int i=42; i <= 254; i++){
          server[3]=i;
          Serial.println(server);
          if (client.connect(server, 80)) {
            Serial.println("connected");
            // Make a HTTP request:
            String prova="GET /newip.php?mac="+mac_string;
            //Serial.println(mac[0],HEX);
            Serial.println(prova);
            client.println(prova);
            client.println();
            Serial.print("Parametro ricevuto: ");
            while(client.connected() && !client.available()) delay(1); //waits for data
            while (client.connected() || client.available()) { //connected or data available
              char c = client.read(); //gets byte from ethernet buffer
              //Serial.print(c); //prints byte to serial monitor 
              buffer=buffer+c;
            }
            Serial.println(buffer);
            
            // Parser del buffer
            indice1=buffer.indexOf('[');
            indice2=buffer.indexOf(']');
           
            
            /* converto buffer in numero */           
            newbuffer=buffer.substring(indice1+1,indice2);
            
            for (int i=0; i < newbuffer.length(); i++){
                nuovo_ip=nuovo_ip + 10 - (newbuffer[i] - '0');
            }
            
            FLAG_Server=1;
            break;
          }     
       }  
  } 
   
  delay(1000);   
}

void Lampeggio(int quanto, int colore){
  
   // colore = 1 == Rosso
   // colore = 2 == Giallo
   // colore = 3 == Rosso e Giallo
      
   for (int i = 0; i <= quanto; i++) {
     switch (colore) {
        case 1:
          digitalWrite(Rosso, HIGH);
          delay(1000);
          digitalWrite(Rosso, LOW);
          break;
        case 2:
          digitalWrite(Giallo, HIGH);
          delay(1000);
          digitalWrite(Giallo, LOW);
          break;
        case 3:
          digitalWrite(Rosso, HIGH);
          digitalWrite(Giallo, HIGH);
          delay(1000);
          digitalWrite(Rosso, LOW);          
          digitalWrite(Giallo, LOW);
          break;
        default: 
          break;
          // if nothing else matches, do the default
          // default is optional
    }
    delay(1000);
  
  }
}

What does it display on your Serial Monitor?
Does it ever print "Connessione = 1" ?

If this is an Uno, you can't use D10-13 for LEDS when using the SPI. The ethernet shield uses the SPI bus for both the w5100 and uSD. Use other pins.

tanks, that was the problem!
Where I can read info to understand if a pin it used from w5100?

I use the product schematics. D4 is used by the uSD card if there is one in the slot. D2 is used on some for an interrupt line.

Hi
I understand that D4 is used as the chip select for the SD card. what pin is used for the chip select of the W5100 chip?
Thanks
Don

what pin is used for the chip select of the W5100 chip?

Pin 10.