title: Can you use all the ESP32's GPIO pins when the WiFi is working?
body: <p>I have a weird phenomenon that when I add the WiFi library and all the settings, 2 out of 3 sensors stop working. When I remove the WiFi code it works like it used to.</p>
  <p>I have an ESP32 devkit v1 board and connected 3 sensors which are a photoresistor (ky-018), a dht-11, and a capacitive soil moisture sensor.</p>
  <ul>
  <li>dht-11 is connected to D14 (works);</li>
  <li>photoresistor(ky-018) connected to D13 (doesn't work);</li>
  <li>capacitive soil moisture sensor connected to D15 (doesn't work).</li>
  </ul>
  <p>I tried changing pins; didn't help.</p>
  <p><a href="https://i.stack.imgur.com/Nt17a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Nt17a.png" alt="Esp-32 devkit v1" /></a></p>
  <p>Here is the code:</p>
  <pre class="lang-cpp prettyprint-override"><code>#include &quot;DHT.h&quot;
  #include &lt;WiFi.h&gt;
  
  #define DHTPIN 14       // Digital pin connected to the DHT sensor
  #define DHTTYPE DHT11   // DHT 11
  
  const char* ssid = &quot;Cgates_E031F1&quot;; // ESP32 and ESP8266 uses 2.4GHZ wifi only
  const char* password = &quot;60E541C32F&quot;;
  
  DHT dht(DHTPIN, DHTTYPE);
  const byte lightPin = 13;
  int lightReading;
  int lightReadingpercent=0;
  const int RELAY_PIN = 15;    // the Arduino pin, which connects to the IN pin of relay
  const int AirValue = 4095;   //you need to replace this value with Value_1
  const int WaterValue = 2200; //you need to replace this value with Value_2
  const int SensorPin = 15;    // Soil moisture
  
  int soilMoistureValue = 0;
  int soilmoisturepercent=0;
  const int Lightvalue = 0;
  const int Darkvalue = 4095;
   
  
  void setup() {
    // put your setup code here, to run once:
    Serial.begin(9600);
  
    // begin Wifi connect
    Serial.print(&quot;Connecting to &quot;);
    Serial.println(ssid);
    WiFi.mode(WIFI_STA);
    WiFi.disconnect();
    delay(2000);
    WiFi.begin(ssid, password);
    
    while (WiFi.status() != WL_CONNECTED) {
      delay(500);
      Serial.print(&quot;.&quot;);
    }
   
    Serial.println(&quot;&quot;);
    Serial.println(&quot;WiFi connected&quot;);  
    Serial.println(&quot;IP address: &quot;);
    Serial.println(WiFi.localIP());
    //end Wifi connect
   
    pinMode(RELAY_PIN, OUTPUT);//relay
    
    Serial.println(F(&quot;DHTxx test!&quot;)); //dht
    ; 
    dht.begin();
  }
  
  void loop() {
    // put your main code here, to run repeatedly:
  
    lightReading = analogRead(lightPin); //0-4095 12bit -- esp8266 10bit 0-1023 -- arduino 8bit 0-254
   
    Serial.print(&quot;Light reading = &quot;);
    
    lightReadingpercent = map(lightReading, Darkvalue, Lightvalue,  0, 100 );
    Serial.print(lightReadingpercent);
    Serial.println(&quot; %&quot;);
    Serial.println();
    
    delay(500);
  
    soilMoistureValue = analogRead(SensorPin);  //put Sensor insert into soil 
  
    soilmoisturepercent = map(soilMoistureValue, AirValue, WaterValue, 0, 100);
  
    if (soilmoisturepercent &gt; 100) {
      Serial.println(&quot;Soil moisture &quot;);
      Serial.println(&quot;100 %&quot;);
      delay(500);
    } else if (soilmoisturepercent &lt;0) {
      Serial.println(&quot;Soil moisture &quot;);
      Serial.println(&quot;0 %&quot;);
      delay(500);
    } else if (soilmoisturepercent &gt;=0 &amp;&amp; soilmoisturepercent &lt;= 100) {
      Serial.println(&quot;Soil moisture &quot;); //go to next line
      Serial.print(soilmoisturepercent);
      Serial.println(&quot;%&quot;);
      delay(500); // soil end
    }
   
    // Wait a few seconds between measurements.
    delay(2000);
  
    // Reading temperature or humidity takes about 250 milliseconds!
    // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
    float h = dht.readHumidity();
    // Read temperature as Celsius (the default)
    float t = dht.readTemperature();
    // Read temperature as Fahrenheit (isFahrenheit = true)
    float f = dht.readTemperature(true);
  
    // Check if any reads failed and exit early (to try again).
    if (isnan(h) || isnan(t) || isnan(f)) {
      Serial.println(F(&quot;Failed to read from DHT sensor!&quot;));
      return;
    }
  
    // Compute heat index in Fahrenheit (the default)
    float hif = dht.computeHeatIndex(f, h);
    // Compute heat index in Celsius (isFahreheit = false)
    float hic = dht.computeHeatIndex(t, h, false);
  
    Serial.print(F(&quot; Humidity: &quot;));
    Serial.print(h);
    Serial.print(F(&quot;%  Temperature: &quot;));
    Serial.print(t);
    Serial.print(F(&quot;C &quot;));
    Serial.print(f);
    Serial.print(F(&quot;F  Heat index: &quot;));
    Serial.print(hic);
    Serial.print(F(&quot;C &quot;));
    Serial.print(hif);
    Serial.println(F(&quot;F&quot;));
  
    delay(500); //wait 0.5seconds
  }
  </code></pre>