Code ne tourne pas

Bonjour, j'aurais besion d'aide pour achever mon projet de babyphone connecté. j'ai était obligé de me tourner vers des feather adafruit, l'ethernet featherWing couplé au feather M0 Analogger, le Shield ethernet d'arduino n'étant plus commercialisé.

Mon code ne tourne pas comme il faudrait si je n'ouvre pas le moniteur série. J'arrive à me connecter à mon réseau, une adresse IP est assignée mais ensuite il semblerait que le programme se bloque, je n'arrive pas à avoir les retours de mes capteurs.

J'ai déjà fais un autre projet style station météo avec un shield ethernet et une fois alimenté tout fonctionne très bien, je ne comprend pas pourquoi je dois lancer le moniteur série pour initialisé mon code cette fois ci.

Voici mon code si quelqu'un trouve le problème :

#include <SPI.h>
#include <Ethernet2.h> //Inclure la biblioth�que Ethernet
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_TSL2561_U.h>
#include "Adafruit_SHT31.h"
#include <Arduino.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 };
    // if you don't want to use DNS (and reduce your sketch size)
    // use the numeric IP instead of the name for the server:
    //IPAddress server(74,125,232,128);  // numeric IP for Google (no DNS)
//#define URLHOST "www.adafruit.com"    // name address for Adafruit (using DNS)
//#define URLPATH "/testwifi/index.html" // url to grab
     
    // Set the static IP address to use if the DHCP fails to assign
    //IPAddress ip(192, 168, 0, 177);
     
    // 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):
EthernetClient client;
String data;
String stringVal;
EthernetServer server(80); //Initialise le serveur Ethernet, port 80 par d�faut pour HTTP
     
unsigned long lastConnectionTime = 0;             // last time you connected to the server, in milliseconds
const unsigned long postingInterval = 10L * 1000L; // delay between updates, in milliseconds
// the "L" is needed to use long type numbers

//#define WIZ_RESET 9
#if defined(ESP8266)
  // default for ESPressif
  #define WIZ_CS 15
#elif defined(ESP32)
  #define WIZ_CS 33
#elif defined(ARDUINO_STM32_FEATHER)
  // default for WICED
  #define WIZ_CS PB4
#elif defined(TEENSYDUINO)
  #define WIZ_CS 10
#elif defined(ARDUINO_FEATHER52)
  #define WIZ_CS 11
#else   // default for 328p, 32u4, M4 and M0
  #define WIZ_CS 10
#endif
     
const int Led1 = 6;
const int Led2 = 12;

Adafruit_SHT31 sht31 = Adafruit_SHT31();
Adafruit_TSL2561_Unified tsl = Adafruit_TSL2561_Unified(TSL2561_ADDR_FLOAT, 12345);
boolean reading;
const int sampleWindow = 50; // Sample window width in mS (50 mS = 20Hz)
unsigned int sample;
int pleur;
int lumiere;
int temperature;
int humidite;
int calibrationTime = 30;

int inputPin = 5;               // choose the input pin (for PIR sensor)
int pirState = LOW;             // we start, assuming no motion detected
int val = 0;                    // variable for reading the pin status

void setup()
{
  pinMode(Led1, OUTPUT);
  pinMode(Led2, OUTPUT);
  pinMode(inputPin, INPUT);     // declare sensor as input
  
    #if defined(WIZ_RESET)
      pinMode(WIZ_RESET, OUTPUT);
      digitalWrite(WIZ_RESET, HIGH);
      delay(100);
      digitalWrite(WIZ_RESET, LOW);
      delay(100);
      digitalWrite(WIZ_RESET, HIGH);
    #endif
     
    #if !defined(ESP8266) 
      while (!Serial); // wait for serial port to connect.
    #endif
     
      // Open serial communications and wait for port to open:
      Serial.begin(115200);
      reading = false;
      delay(1000);
      Serial.println("\nHello! I am the Ethernet FeatherWing");
     
      Ethernet.init(WIZ_CS);
      
      // give the ethernet module time to boot up:
      delay(1000);
     
      // start the Ethernet connection:
      if (Ethernet.begin(mac) == 0) {
        Serial.println("Failed to configure Ethernet using DHCP");
        // no point in carrying on, so do nothing forevermore:
        // try to congifure using IP address instead of DHCP:
        Ethernet.begin(mac);
        server.begin();
      }
      
      // print the Ethernet board/shield's IP address:
      Serial.print("My IP address: ");
      Serial.println(Ethernet.localIP());
   
  Serial.println("Light Sensor Test"); Serial.println("");
  /* Initialise the sensor */
  if (!tsl.begin())
  {
    /* There was a problem detecting the TSL2561 ... check your connections */
    Serial.print("Ooops, no TSL2561 detected ... Check your wiring or I2C ADDR!");
    while (1);
  }
  configureSensor();
  Serial.print("calibrating sensor ");
  for(int i = 0; i < calibrationTime; i++){
    Serial.print(".");
  }
    //while (!Serial)
    //delay(10);     // will pause Zero, Leonardo, etc until serial console opens

  Serial.println("SHT31 test");
  if (! sht31.begin(0x44)) {   // Set to 0x45 for alternate i2c addr
    Serial.println("Couldn't find SHT31");
    while (1) delay(1);
  }
  Serial.println("");
  delay(1000);
}

Bonsoir

Mon code ne tourne pas comme il faudrait si je n'ouvre pas le moniteur série

Une attente d'ouverture préalable du port série est demandée içi .... ou pas, selon la cible choisie
Comme vous n'avez pas l'ESP8266... ....vous demandez l'attente....
Probablement un code écrit en pensant a une carte Feather dotée d'un ATMega 32u4...

    #if !defined(ESP8266) 
      while (!Serial); // wait for serial port to connect.
    #endif