fatal error: ESP8266WiFi.h: No such file or directory #include <ESP8266WiFi.h>

Hi,

I am a beginner in Arduino. I read few blog of Arduino basics. Then i tried working on sending sensor data from ESp8266 in Arduino. But I am getting an error when compiling the code.

fatal error: ESP8266WiFi.h: No such file or directory
#include <ESP8266WiFi.h>
I have ESP8266 Serial Wifi module in Arduino board. I enabled esp8266 library in my code. But still its showing an error. Kindly assist me where I am wrong. It would be good if anybody share the basic code for sending the dht22 sensor data from esp 8266 interface in Arduino board.
Regards
Karthik S

ESP8266WiFi.h is part of the ESP8266 core for Arduino: https://github.com/esp8266/Arduino/ That core is used to add support to the Arduino IDE for directly programming the ESP8266. ESP8266WiFi.h will only be accessible when you have one of the ESP8266 core boards selected from the Arduino IDE's Tools > Board menu.

If you're using the ESP8266 as merely a WiFi adapter module connected to a different Arduino board and you are programming that Arduino board rather than the ESP8266 then you will not be able to use any code that requires ESP8266WiFi.h.

Make sure you have selected the rigth board e.g. Wemos D1 if it selected arduino 1 the error is displayed. For ESP availability you need set in preferences the url https://arduino.esp8266.com/stable/package_esp8266com_index.json

then install library fynally reload your IDE.