ESP32 board can't compile the ESP8266wifi.h include file

1.4k views Asked by At

I use ESP32 board. I want to get the content from google sheet. my reference code is as below The error was ESP8266WiFi.h: No such file or directory. Does anyone give me some suggestion? Thanks

`#include <ESP8266WiFi.h>
 #include "HTTPSRedirect.h"
 const char* ssid = " ";
 const char* password = " ";
 const char* host = "script.google.com";
 const char *GScriptId = "";
 const int httpsPort = 443;
 HTTPSRedirect* client ;
 void setup(){
     WiFi.begin(ssid, password);
     client = new HTTPSRedirect(httpsPort);
     client->setPrintResponseBody(true);
     client->setContentTypeHeader("application/json");
     client->connect(host, httpsPort);
 }
 void loop() {
     String url3 = String("/macros/s/") + GScriptId + "/exec?&id=";       
     if (client->GET(url3, host)){
         Serial.println("GET SUCCESS");
     }  
     delay(4000);                          
 }`
1

There are 1 answers

2
romkey On BEST ANSWER

You're building for an ESP32. The ESP32 is not an ESP8266. ESP8266WiFi.h is, oddly enough, for the ESP8266, not the ESP32. It's just WiFi.h on the ESP32.