简体   繁体   English

为什么ESP32收不到发送的wifi信号?

[英]Why ESP32 is not receiving the sending wifi signals?

I'm developing a project on wifi-range extending using two ESP32 WROOM 32 modules as transmitter and receiver.我正在开发一个使用两个 ESP32 WROOM 32 模块作为发射器和接收器的 wifi 范围扩展项目。 So far I have completed the transmission side & it gives the following output for the given Arduino code.到目前为止,我已经完成了传输端,它为给定的 Arduino 代码提供了以下输出。 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 "."错误是,虽然发送器向接收器发送 IP 报价,但接收器配置为 LR 模式,只打印错误为 0 和“模式 LR OK”并连续打印“。” s. s。 After that it is not connected to the Wifi transmitter ESP32.之后它没有连接到 Wifi 发射器 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?所以我需要知道的是为什么它没有从发射器 ESP32 连接到 Wifi?

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.嗯 - 不知道潜在的编码问题,但我可以在您的发射机输出中看到来自两个不同子网(192.168.115.42 与 192.168.4.1)的 IP。 Are you sure both - transmitter and receiver - are in the same IP subnet?您确定发射器和接收器都在同一个 IP 子网中吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM