Merging sensor codes + deep sleep

I am trying to merge two codes for two separate sensors so that they will both run using an Esp32. I was able to create a code that works without using deep sleep mode. However, when adding the code required for deep sleep I get an error that reads "Error compiling for board WiFi Kit 32." I will post the full code below, can anyone help?

#include <Wire.h>
#include <Adafruit_MLX90614.h>
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <esp_sleep.h>

Adafruit_MLX90614 mlx = Adafruit_MLX90614();
SoftwareSerial serial_connection(36, 37);
TinyGPSPlus gps;

void GotoSleep()
{
Serial.println("Going to sleep....");

esp_sleep_enable_timer_wakeup(15*1000000);
esp_deep_sleep_start();
}

void setup()
{
Serial.begin(9600);
mlx.begin();
serial_connection.begin(9600);

Serial.print("Ambient = ");
Serial.print(mlx.readAmbientTempC());
Serial.print("*C\tObject = ");
Serial.print(mlx.readObjectTempC());
Serial.println("*C");
Serial.print("Ambient = ");
Serial.print(mlx.readAmbientTempF());
Serial.print("*F\tObject = ");
Serial.print(mlx.readObjectTempF());
Serial.println("*F");
Serial.println();

while(serial_connection.available())//While there are characters to come from the GPS
{
gps.encode(serial_connection.read());//This feeds the serial NMEA data into the library one char at a time
}
if(gps.location.isUpdated())//This will pretty much be fired all the time anyway but will at least reduce it to only after a package of NMEA data comes in
{
//Get the latest info from the gps object which it derived from the data sent by the GPS unit
Serial.println("Latitude:");
Serial.println(gps.location.lat(), 6);
Serial.println("Longitude:");
Serial.println(gps.location.lng(), 6);
}

GotoSleep();
}

I doubt that at least not with the posted code. SoftwareSerial is not available on the ESP32 platform (as you don't need it).

BTW: mark your code as code! Post links to all libraries not available in the library manager!

The rest of the code compiles for an ESP32 given you add the mandatory loop() routine.

So how would I get it to work without the software serial, would the Tinygps library run on its own?

You still didn't provide a link to the library you're using and it's not available in the library manager of the IDE.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.