0
私はESP8266で気象情報を取得してOLEDディスプレイに表示しようとしていました。ESP8266 Arduino IDE JSON HTTPリクエスト
if (!client.connect("api.apixu.com", 80)) {
Serial.println("connection failed");
return;}
client.print("GET " + url + " HTTP/1.1\r\n" +
"Host: " + host + "\r\n" +
"Content-Type: application/json\r\n" +
"Connection: close\r\n\r\n");
char c[1024];
// Read all the lines of the reply from server and print them to Serial
while(client.available()){
c[0] = client.read();Serial.print(c);}
これは、JSONコンテンツをリクエストして読み取るためのコードです。しかし、私が試してみると、コードはwhileループに入りません。
誰かが間違いを見つけられますか?
ありがとうございます! :D