FS.h no such file or directory

Hello. When i include ESPAsyncWebServer.h in my sketch, i get the following error.

Here is my code.

#include <Arduino.h>
#include <WiFi.h>
#include <ESPAsyncWebServer.h>
#include "credentials.h"

#define anemometerIn 2  // connect anemometer to digital pin 2
#define rainGaugeIn 3   // connect rain gauge to digital pin 3
#define windVaneIn A0   // connect wind vane to analog pin 0

// anemometer variables
const int circumference = 22.765;  // circumference of anemometer
volatile float lastMillis;         // last time anemometerIn was high
volatile float timeTaken;          // time between pulses
volatile float rpm = 0;            // rpms of anemometer
volatile int rotation = 0;         // keeps count of rotations
float mph = 0;                     // miles per hour
float ipm = 0;                     // inches per minute
float iph = 0;                     // inches per hour

// wind vane variables
int windVaneSignal = 0;     // input from wind vane
String windDirection = "";  // store wind direction

// rain gauge variables
float rainFall = 0;       // one tip of the rain gauge bucket
int readRainGaugeIn = 0;  // input data from the rain gauge
int bucketState = 0;      // state of rain gauge bucket. on/off
float lastCycleTime = 0;  // millis() time reading from last bucket cycle

int serialDebugSampleRate = 500;  // sample rate of 100 milliseconds for the serialDebug function
float delayLastMillis1;           // last millis reading for non blocking delay no.1

//access point web server variables
const char* soft_ap_ssid = esp32_ap_ssid;   // access point ssid from credentials.h
const char* soft_ap_pass = esp_32_ap_pass;  // access point password from credentials.h

//local network web server variables
const char* wifi_ssid = local_network_ssid;  // local network ssid from credentials.h
const char* wifi_pass = local_network_pass;  // local network password from credentials.h

AsyncWebServer server(80);

void setup() {
  Serial.begin(115200);  // start serial communication at 115200 baud rate

  WiFi.mode(WIFI_MODE_APSTA);               //access point mode
  WiFi.softAP(soft_ap_ssid, soft_ap_pass);  //start access point
  WiFi.begin(wifi_ssid, wifi_pass);         //start connect to local network

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.println("Connecting to WiFi..");
  }

  Serial.print("ESP32 IP on AP: ");
  Serial.println(WiFi.softAPIP);

  Serial.print("ESP32 IP on WiFi network: ");
  Serial.println(WiFi.localIP);
  
  pinMode(anemometerIn, INPUT);       // set anemometerIn as INPUT
  pinMode(rainGaugeIn, INPUT);        // set rainGaugeIn as INPUT
  pinMode(windVaneIn, INPUT_PULLUP);  // set windVaneIn as INPUT

  attachInterrupt(digitalPinToInterrupt(anemometerIn), windSpeedTimer, CHANGE);  // attach interrupt to anemometerIn, triggering windSpeedTimer()

}  // end void setup

void loop() {
  calculateMPH();      // start calculateMPH()
  getWindDirection();  // start getWindDirection()
  getRainFall();       // start getRainFall()

  // non blocking delay no.1, for timing serial output
  if (millis() > delayLastMillis1 + serialDebugSampleRate) {
    delayLastMillis1 = millis();
    serialDebug();
  }
}

// create function to calculate miles per hour
void calculateMPH() {
  ipm = rpm * circumference;  // multiply rpm by circumference to get inches per minute
  iph = ipm * 60;             // multiply ipm by 60 to get inches per hour
  mph = iph / 63360;          // 63,360 inches = 1 mile

  if (millis() - lastMillis > 5000) {  // no data has been received for 5 seconds
    rpm = 0;                           // set rpm to zero
  }
}

// create function to calculate rpms
void windSpeedTimer() {
  rotation++;  // store rotations
  if (rotation >= 8) {
    timeTaken = millis() - lastMillis;
    rpm = (1000 / timeTaken) * 60;
    lastMillis = millis();
    rotation = 0;
  }
}

// create function to calculate wind direction
void getWindDirection() {
  windVaneSignal = analogRead(windVaneIn);  // read analog values from windVaneIn

  if (windVaneSignal > 460 && windVaneSignal < 500) {
    windDirection = "North";
  } else if (windVaneSignal > 180 && windVaneSignal < 220) {
    windDirection = "NorthEast";
  } else if (windVaneSignal > 20 && windVaneSignal < 60) {
    windDirection = "East ";
  } else if (windVaneSignal > 60 && windVaneSignal < 90) {
    windDirection = "SouthEast";
  } else if (windVaneSignal > 90 && windVaneSignal < 130) {
    windDirection = "South";
  } else if (windVaneSignal > 300 && windVaneSignal < 330) {
    windDirection = "SouthWest";
  } else if (windVaneSignal > 980 && windVaneSignal < 1020) {
    windDirection = "West ";
  } else if (windVaneSignal > 620 && windVaneSignal < 660) {
    windDirection = "NorthWest";
  }
}

// create function to calculate rain fall
void getRainFall() {
  readRainGaugeIn = digitalRead(rainGaugeIn);  // read signal from rainGaugeIn

  if (readRainGaugeIn == 1 && bucketState == 0) {
    rainFall += 0.011;  // bucket holds 0.011 inches of water
    bucketState = 1;
    lastCycleTime = millis();
  } else if (readRainGaugeIn == LOW) {
    bucketState = LOW;
  }

  if (millis() - lastCycleTime > 5000) {  // no signal for 5 seconds
    rainFall = 0;                         // set rainFall to zero
    lastCycleTime = 0;                    // reset lastCycleTime
  }
}

void serialDebug() {
  Serial.print("Wind Speed: ");
  Serial.print(mph, 1);
  Serial.print(" MPH");
  Serial.print("\t");
  Serial.print("Wind Vane: ");
  Serial.print(windDirection);
  Serial.print("\t");
  Serial.print("RainFall: ");
  Serial.print(rainFall, 3);
  Serial.print("\n");
}

This is the error.

In file included from C:\Users\swp791\Documents\Arduino\Mike Arduino\Test_WeatherStation\Test_WeatherStation.ino:3:0:
c:\Users\swp791\Documents\Arduino\libraries\ESP_Async_WebServer\src/ESPAsyncWebServer.h:26:10: fatal error: FS.h: No such file or directory
 #include <FS.h>
          ^~~~~~
compilation terminated.
exit status 1

Compilation error: exit status 1

Hi @superbwoodpecker791. Which board do you have selected in Arduino IDE's Tools > Board menu?

The Uno.

OK. Thanks @ptillisch for the idea. I was using the uno because it compiles faster, but after changing the board to XIAO ESP32C3 (The board i will be using) it compiles properly. :grinning:

You are welcome. I'm glad it is working now.

Regards, Per