Soil Moisture sensor

robtillaart:
depends if the
pinMode(sensorPin3, INPUT);
is done before or after the serial.begin()

Note that the OP nowhere uses the Serial in its sketch so his code is OK in that sense.

So you're saying that if this case

 case 5:
    Serial.print("Valeur sensor #1: ");
    Serial.println(avg1);
    Serial.println();
    Serial.print("Valeur sensor #2: ");
    Serial.println(avg2);
    Serial.println();
    Serial.print("Valeur sensor #3: ");
    Serial.println(avg3);
    Serial.println();
    Serial.print("Valeur sensor #4: ");
    Serial.println(avg4);
    Serial.println("-----------------------");
     Serial.print("Valeur moyenne de tout les sensors: ");
    Serial.println((avg1+avg2+avg3+avg4)/4);
    Serial.println();
    Serial.println();
    currentsensor=1;
    break;

is never executed, it's all good? Seems kind of iffy to me.