|
贴代码:
[mw_shl_code=arduino,true]#include<ESP8266WiFi.h>
const char* ssid = "hx2.4";
const char* password = "82813158";
const char* host = "www.baidu.com";
void setup() {
Serial.begin(115200);
WiFi.begin(ssid,password);
while(WiFi.status()!=WL_CONNECTED){
delay(500);
Serial.print(".");
}
Serial.print("\n");
Serial.println("Connected!");
Serial.println(WiFi.localIP());
}
void loop() {
Serial.print("Connecting to :");
Serial.println(host);
WiFiClient client;
int httpPort = 80;
if(!client.connect(host,httpPort)){
Serial.println("Connected Failed!");
return ;
}
client.print(String("GET /")+"HTTP/1.1\r\n");
delay(60);
while(client.available()){
String line = client.readStringUntil('\r');
Serial.print(line);
}
Serial.print("\n Closing connection");
delay(6300);
}[/mw_shl_code]
好久没玩arduino了,刚刚买了块ESP8266准备玩玩,打算去连接bilibili无限矿业公司,都是按着教程走的,可是无论是bilibili还是百度都是404???
求助,原因
|
|