Hi friends. when I compile sketch for ESP32 get error . where is wrong ?
Arduino: 1.8.5 (Windows 10), Board: "ESP32 Dev Module, Default, QIO, 80MHz, 4MB (32Mb), 921600, None"
C:\Users\ERFAN\Documents\Arduino\sketch_apr08a\sketch_apr08a.ino:1:28: fatal error: SoftwareSerial.h: No such file or directory
compilation terminated.
exit status 1
Error compiling for board ESP32 Dev Module.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
the sketch is:
#include <SoftwareSerial.h>
#include <TinyGPS++.h>
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <SimpleTimer.h>
static const int RXPin = 15, TXPin = 18;
static const uint32_t GPSBaud = 9600;
TinyGPSPlus gps; // The TinyGPS++ object
SoftwareSerial ss(RXPin, TXPin); // The serial connection to the GPS device
SimpleTimer timer;
char auth[] = "b094dd9875d8498089c169e8a776bc02";
char ssid[] = "MikroTik Home";
char pass[] = "12345678";
char server[] ="10.5.51.3";
//unsigned int move_index; // moving index, to be used later
unsigned int move_index = 1; // fixed location for now
bool simulation = false; // set to true for simulation mode, else false. If IranHack is true this must be false
// simulation location is in Egypt
bool IranHack = false; // set to true if GPS is faulty, else false. If simulation is true this must be false
WidgetMap myMap(V5);
void setup()
{
Serial.begin(115200);
Serial.println();
ss.begin(GPSBaud);
Blynk.begin(auth, ssid, pass, server, 8080);
timer.setInterval(5000L, checkGPS); // every 5s check if GPS is connected, only really needs to be done once
timer.setInterval(100L, check);
}
void checkGPS(){
if (gps.charsProcessed() < 10)
{
Serial.println(F("No GPS detected: check wiring."));
Blynk.virtualWrite(V10, "GPS ERROR"); // Value Display widget set as PUSH frequency on V10
Blynk.virtualWrite(V7, "--------"); // Value Display widget set as PUSH frequency on V7 LATITUDE
Blynk.virtualWrite(V8, "--------"); // Value Display widget set as PUSH frequency on V8 LONGITUDE
}
}
void displayInfo()
{
if (gps.location.isValid() || simulation == true || IranHack == true)
{
//move_index++; // moving index, maybe use later
Blynk.virtualWrite(V10, "GPS OK");
float latitude = (gps.location.lat()); // removed , 6 as it can't be used for creating the float
float longitude = (gps.location.lng()); // removed , 6 as it can't be used for creating the float
if(latitude == 0 && longitude == 0 ) // checking to see if the 2 floats variables are correct
{
Blynk.virtualWrite(V7, "--------");
Blynk.virtualWrite(V8, "--------");
Blynk.virtualWrite(V10, "0,0");
}
if(simulation == true) // location in Egypt
{
latitude = 30.000123; // also used for debugging
longitude = 30.000987; // also used for debugging
}
if(IranHack == true)
{
latitude = 32.644824;
longitude = 41.681746;
}
Serial.print("LAT: ");
Serial.println(latitude, 6); // float to x decimal places
Serial.print("LONG: ");
Serial.println(longitude, 6);
Blynk.virtualWrite(V7, String(latitude, 6));
Blynk.virtualWrite(V8, String(longitude, 6));
myMap.location(move_index, latitude, longitude, "GPS_Location");
}
else
{
Serial.print(F("INVALID"));
Blynk.virtualWrite(V10, "GPS INVALID");
Blynk.virtualWrite(V7, "--------");
Blynk.virtualWrite(V8, "--------");
}
Serial.println();
}
void check()
{
if(simulation == true || IranHack == true)
{
displayInfo();
}
else
{
while (ss.available() > 0) // sketch displays information every time a new sentence is correctly encoded.
if (gps.encode(ss.read()))
displayInfo();
}
}
void loop()
{
Blynk.run();
timer.run();
}
thanks