I have noticed after removing conflicting pins declared in my blynk project merged with edgent code, the code does not compile unless I comment out //#include <BlynkSimpleEsp32.h>
if I comment it and upload, I don’t receive any data or response from the esp32 board even though the board connects to the server. Kindly assist, here is my code
// Fill-in information from your Blynk Template here
#define BLYNK_TEMPLATE_ID "TMPLomrtSerD"
#define BLYNK_DEVICE_NAME "Quickstart Template"
#define BLYNK_FIRMWARE_VERSION "0.1.0"
#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG
#define APP_DEBUG
#define LED 14 // LED at GPIO14
#include <WiFi.h>
#include <WiFiClient.h>
//#include <BlynkSimpleEsp32.h>
#include <Adafruit_BMP280.h>
// Uncomment your board, or configure a custom board in Settings.h
//#define USE_WROVER_BOARD
//#define USE_TTGO_T7
//#define USE_ESP32C3_DEV_MODULE
//#define USE_ESP32S2_DEV_KIT
#include "BlynkEdgent.h"
Adafruit_BMP280 bmp; // I2C
//***BMP 280 CODE FOR TEMPERATURE, ALTITUDE AND ATMOSPHERIC PRESURE
// Declaring a global variabl for sensor data
long temperature;
long pressure ;
long altitude ;
// This function creates the timer object. It's part of Blynk library
BlynkTimer timer;
void myTimer()
{
// This function describes what will happen with each timer tick
// e.g. writing sensor value to datastream V5
Blynk.virtualWrite(V3, temperature);
Blynk.virtualWrite(V4, pressure);
Blynk.virtualWrite(V5, altitude);
}
// This function is called every time the Virtual Pin 0,1,2 state changes
BLYNK_WRITE(V0)
{
// Set incoming value from pin V0 to a variable
int value = param.asInt();
// Update state
Blynk.virtualWrite(V0, value);
if (param.asInt() == 1)
{
// execute this code if the switch widget is now ON
digitalWrite(LED, HIGH); // Set digital pin 14 HIGH
}
else
{
// execute this code if the switch widget is now OFF
digitalWrite(LED, LOW); // Set digital pin 2 LOW
}
}
// This function is called every time the device is connected to the Blynk.Cloud
BLYNK_CONNECTED()
{
Blynk.syncVirtual(V0);//stores the previous status of pin 14
Blynk.syncVirtual(V3);//stores the previous temperature reading
Blynk.syncVirtual(V4);//stores the previous pressure reading
Blynk.syncVirtual(V5);//stores the previous altitude reading
}
void setup()
{
Serial.begin(115200);
delay(100);
BlynkEdgent.begin();
timer.setInterval(2000L, myTimer);
//* BMP280 SETUP DETAILS***//
if (!bmp.begin(0x76)) {
Serial.println(F("Could not find a valid BMP280 sensor, check wiring or "
"try a different address!"));
while (1) delay(10);
}
/* Default settings from datasheet. */
bmp.setSampling(Adafruit_BMP280::MODE_FORCED, /* Operating Mode. */
Adafruit_BMP280::SAMPLING_X2, /* Temp. oversampling */
Adafruit_BMP280::SAMPLING_X16, /* Pressure oversampling */
Adafruit_BMP280::FILTER_X16, /* Filtering. */
Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */
/*BMP 280 END OF SETUP DETAILS***/
pinMode(LED, OUTPUT);
}
void loop() {
bmp.takeForcedMeasurement();
temperature = bmp.readTemperature();
pressure = bmp.readPressure() / 1000;
altitude = bmp.readAltitude();
/* serial debugging of the BMP280 sensor*/
/*if (bmp.takeForcedMeasurement()) {
// can now print out the new measurements
Serial.print(F("Temperature = "));
Serial.print(bmp.readTemperature());
Serial.println(" *C");
Serial.print(F("Pressure = "));
Serial.print(bmp.readPressure());
Serial.println(" Pa");
Serial.print(F("Approx altitude = "));
Serial.print(bmp.readAltitude()); //* Adjusted to local forecast!
Serial.println(" m");
Serial.println();
//delay(2000);
}
else
{
Serial.println("Forced measurement failed!");
}
*/
//Blynk.run();
BlynkEdgent.run();
timer.run();