简体   繁体   English

Arduino Wifi Shield服务器无响应

[英]Arduino Wifi Shield server not responding

I'm trying to set up a web server on a Wifi shield following the example here http://arduino.cc/en/Tutorial/WiFiWebServer 我尝试按照以下示例在Wifi防护板上设置Web服务器:http://arduino.cc/en/Tutorial/WiFiWebServer

I'm connecting over WPA. 我正在通过WPA连接。 I just have the wifi shield sat on top of an Arduino Uno, no wires connected. 我只是将wifi屏蔽罩放在Arduino Uno的顶部,没有连接任何电线。

I upload the code with my network details. 我上传了带有网络详细信息的代码。 Green light shows on the wifi shield, everything seems fine. wifi盾上显示绿灯,一切似乎都很好。 Serial monitor reads: 串行监视器读取:

Attempting to connect to SSID: NETGEAR69 SSID: NETGEAR69 IP Address: 192.168.0.7 signal strength (RSSI):-65 dBm 尝试连接到SSID:NETGEAR69 SSID:NETGEAR69 IP地址:192.168.0.7信号强度(RSSI):-65 dBm

But when I go to 192.168.0.7 in a browser (I've tried this on my computer on my home network and on my phone's 3G network as well, same results) nothing will load. 但是,当我在浏览器中转到192.168.0.7时(我在家庭网络和手机的3G网络上的计算机上都尝试过此操作,结果相同),将不会加载任何内容。 Am I doing something wrong? 难道我做错了什么?

What you have looks good. 你所拥有的看起来不错。 The server is responding as expected. 服务器正在按预期方式响应。

Is there an SD card inserted? 是否插入了SD卡? The page you refer to suggests removing it or setting the mode of pin 4 to output to prevent the sketch from hanging. 您所参考的页面建议将其移除或将引脚4的模式设置为输出以防止草图挂起。

The only other thing to suggest is change the html output to the client. 建议的另一件事是将html输出更改为客户端。 The sketch in the tutorial doesn't output conforming html as there are no head and body tags. 教程中的草图不会输出符合要求的html,因为没有head和body标签。 Perhaps add such tags and simplify the output by replacing the contents of the if block 也许添加这样的标签并通过替换if块的内容来简化输出

      // send a standard http response header
      client.println("HTTP/1.1 200 OK");
      client.println("Content-Type: text/html");
      client.println("Connection: close");  // the connection will be closed after completion of the response
      client.println("Refresh: 5");  // refresh the page automatically every 5 sec
      client.println();
      client.println("<!DOCTYPE HTML>");
      client.println("<html>");
      // output the value of each analog input pin
      for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
        int sensorReading = analogRead(analogChannel);
        client.print("analog input ");
        client.print(analogChannel);
        client.print(" is ");
        client.print(sensorReading);
        client.println("<br />");       
      }
      client.println("</html>");
      break;

with

      // send a standard http response header
      client.println("HTTP/1.1 200 OK");
      client.println("Content-Type: text/html");
      client.println();
      client.println("<!DOCTYPE HTML>");
      client.println("<html><head></head><body><h1>Hello, World!!</h1></body></html>");
      break;    

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

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