Wifi Was not declared in this scope?

I guess i am doing something very stupid :

I get WiFi was not declared in this scope (using the wifi library)

#include <SoftwareSerial.h>
#include <ESP8266.h>
 
const char* ssid = "home";
const char* password = "xxxxxxxxx";



SoftwareSerial wifiSerial(5, 6); /* RX:D3, TX:D2 */


void setup() 
{

 
           Serial.begin(9600); 
            wifiSerial.begin(9600);
            while (!Serial) 
            {;  
             }


         WiFi.begin(ssid,password);  // @!!!!!

}

You need to include ESP8266WiFi.h

Thanks. I dont get whats going on here .

If i go to the include library-> and choose there ESP8266WiFi , he then adds the #include <ESP8266.h>

If i do what you said with #include <ESP8266WiFi.h> i get :

fatal error: ESP8266WiFi.h: No such file or directory

What is going on here? which is the right library for esp8266 by arduino ? i mean this one :

I have installed it from the manager, have included it as the said (ESP8266.h) ,and got the wifi error .
Then included what you said, and got that fatal error .

Have you installed the ESP8266 core from the board manager? It comes with all the libraries installed. I never had to manually use the library manager.

Yes i did .

I cant include the file with #include <ESP8266WiFi.h> get error that :

ESP8266WiFi.h: No such file or directory.

Why is that ?

(BTW can i use this library with external atmega via serial? not to put it inside the esp ? )

There are possibly other libraries you can use on an AVR to communicate with a connected ESP (AT commands). I have only used the ESP standalone though.

Open one of the examples and see if it compiles.

File->Examples->ESp8266WiFi->WiFiWebServer

Ok seems that you cant use the library for an AVR programming at all .
We need to use external AVR , and we dont want to use nodemcu or other library that require flashing the esp because of production issues .

Do you know any good AT library ?? the spark fun library just has no documentation all all ! only hookup guide.

I have only tested the AT commands through a terminal for a proof of concept. After that I used the ESP8266 directly (overwritten AT firmware to my own).

Have a search on esp8266.com in the Arduino section (not the 'ESP8266 Arduino' section). I recall seeing many projects where people have used an AVR and ESP together. There have also been a few posted on this forum too.

These look promising:

GitHub - itead/ITEADLIB_Arduino_WeeESP8266: An easy-to-use Arduino ESP8266 library besed on AT firmware. << should be in library manager.

If the documentation is sparse, read through and play around with the examples.