Hello,
I'm using an WEMOS D1 MINI ESP32 and I have connected a PIR motion detector to GPIO13. All is working fine if WiFi is off [ #define WIFI_ON 0]. If WiFi is on, feedback of digitalRead( 13) is always 1.
If Wifi is disconnected directly after activation [ WiFi.disconnect();] the Port also work as expected.
I know that ADC2 is not working if WiFi/BT is active, but from my point of view there is no limitation for the functionallity as digital port (INPUT).
Does anyone have experience with it or know this behavior?
Best regards, Arduino4Fun
// WIFI_ON 1 - Is not working "GPIO as Input"
// WIFI_ON 0 - Is working
#define WIFI_ON 1
#if( WIFI_ON == 1 )
#include <WiFi.h>
const char* ssid = "SSID";
const char* password = "PW";
#endif
void setup()
{
Serial.begin( 115200 );
#if( WIFI_ON == 1 )
WiFi.mode( WIFI_STA );
WiFi.begin( ssid, password );
while( WiFi.status() != WL_CONNECTED )
{
delay( 500 );
Serial.print( "." );
}
Serial.println( "" );
Serial.print( "Connected to " );
Serial.println(ssid);
Serial.print( "IP address: " );
Serial.println( WiFi.localIP() );
// WiFi.disconnect();
// Serial.println( "Wifi Off" );
#endif
pinMode( 13,INPUT );
pinMode( LED_BUILTIN,OUTPUT );
}
void loop()
{
int PIR = digitalRead( 13 );
digitalWrite( LED_BUILTIN,PIR );
Serial.println( PIR );
delay( 500 );
}