Why ESP32 is not receiving the sending wifi signals?

386 Views Asked by At

I'm developing a project on wifi-range extending using two ESP32 WROOM 32 modules as transmitter and receiver. So far I have completed the transmission side & it gives the following output for the given Arduino code. Transmitter output in the serial monitor

In the receiver side I,m encountering an error. The error is, though the transmitter transmitting the offer of IP to the receiver, the receiver is config to LR mode & only prints that the error is 0 and the "Mode LR OK" and continuously printing "." s. After that it is not connected to the Wifi transmitter ESP32. The output obtained from the receiver side is the following. Receiver Output in the serial monitor.

The part of the code which is not working is the following.

 

    WiFi.begin(ssid, password);

        //Wifi connection, we connect to the transmitter
        while (WiFi.status() != WL_CONNECTED) 
        {
          delay(500);
          Serial.print(".");
        }

        Serial.println("WiFi connected");
        Serial.print("IP address: ");
        Serial.println(WiFi.localIP());

        udp.begin( 8888 );
        }

    void loop() {
         //If there is a problems whith connection
        if ( WiFi.status() != WL_CONNECTED ) 
        {
            Serial.println( "|" );
            int tries = 0;
            WiFi.begin( ssid, password );
            while( WiFi.status() != WL_CONNECTED ) {
                tries++;
                if ( tries == 5 )
                    return;
                Serial.println( toStr( WiFi.status() ) );
                delay( 1000 );
            }
            Serial.print( "Connected " );
            Serial.println( WiFi.localIP() );
        }
        //if connection is OK, execute command 'b' from master
        int size = udp.parsePacket();
        if ( size == 0 )
            return;
        char c = udp.read();
        if ( c == 'b' ){
            digitalWrite(5, !digitalRead(5));//toggle Led
            Serial.println("RECEIVED!");
            Serial.println(millis());
        }
        udp.flush();
        }

So the thing I need to know is why is it not connecting to the Wifi from the transmitter ESP32?

1

There are 1 best solutions below

0
Sascha On

Hmmm - don‘t know about potential coding issues, but I can see IPs from two different subnets (192.168.115.42 vs. 192.168.4.1) in your transmitter output. Are you sure both - transmitter and receiver - are in the same IP subnet?