Hello, I’m using esp32, blynk iot, the error is ‘class blynkwifi’ has no member named ‘email’
This is the code:
#define BLYNK_TEMPLATE_ID ""
#define BLYNK_TEMPLATE_NAME "LED"
#define BLYNK_AUTH_TOKEN "
"
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
#define LED 2
//Adafruit_MPU6050 mpu;
int ledState;
int value;
// WiFi credentials
char ssid[] = "";
char pass[] = "";
// Blynk Authorization Token
char auth[] = BLYNK_AUTH_TOKEN; // Correctly declare the auth variable
BlynkTimer timer;
void setup(void) {
Serial.begin(115200);
pinMode(LED, OUTPUT);
while (!Serial); // Wait for serial port to connect. Needed for native USB port only
//Serial.println("Adafruit MPU6050 test!");
//if (!mpu.begin()) {
//Serial.println("Failed to find MPU6050 chip");
//while (1) {
//delay(10);
//}
//}
//Serial.println("MPU6050 Found!");
//mpu.setHighPassFilter(MPU6050_HIGHPASS_0_63_HZ);
//mpu.setMotionDetectionThreshold(1);
//mpu.setMotionDetectionDuration(20);
//mpu.setInterruptPinLatch(true);
//mpu.setInterruptPinPolarity(true);
//mpu.setMotionInterrupt(true);
Blynk.begin(auth, ssid, pass); // Use the auth variable to establish a connection to the Blynk server
}
void loop() {
Blynk.run();
timer.run(); // Initiates BlynkTimer
}
// Function to handle the button press
BLYNK_WRITE(V0) {
int value = param.asInt();
digitalWrite(LED, value); // Turn LED on or off based on button state
}
// Function to send email status
void sendEmailStatus() {
int ledState = digitalRead(LED);
Blynk.virtualWrite(V2, ledState);
if (ledState == HIGH) {
// Send email when LED is turned on
Serial.println("Sending email: LED turned on");
Blynk.email("", "LED Status", "The LED has been turned on.");
Blynk.logEvent("LED", "LED is on");
}
else {
// Send email when LED is turned off
Serial.println("Sending email: LED turned off");
Blynk.email("", "LED Status", "The LED has been turned off.");
Blynk.logEvent("LED", "LED is off");
}
}