Hello there,
I am working on a project that sends a notification to your phone if your plant needs watering using nodemcu and IFTTT and its app.
However, when I try to compile I get this error message :
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
This was not highlighted in the error message but the font color was red :
C:\Users\jehad\Desktop\Documents\Arduino\libraries\ESP8266Webhook-master\ESP8266Webhook.cpp: In member function 'int Webhook::trigger(String, String, String)':
C:\Users\jehad\Desktop\Documents\Arduino\libraries\ESP8266Webhook-master\ESP8266Webhook.cpp:48:13: error: call to 'HTTPClient::begin' declared with attribute error: obsolete API, use ::begin(WiFiClient, url)
48 | http.begin("http://maker.ifttt.com/trigger/"+_event_name+"/with/key/"+_api_key+"?value1="+value_1+"&value2="+value_2+"&value3="+value_3);
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From my knowledge I think there is something wrong with the webhook library, I'm not sure.
Here is the code :
#include <ESP8266Webhook.h>
#include <ESP8266WiFi.h>
#define _SSID "private info" // Your WiFi SSID
#define _PASSWORD "private info" // Your WiFi Password
#define KEY "private info" // Webhooks Key
#define EVENT "plant_watering" // Webhooks Event Name
Webhook webhook(KEY,EVENT);
#define sensorpin A0
void setup() {
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(1000);
// Connect to WiFi
Serial.println();
Serial.println();
Serial.print("Connecting to: ");
Serial.println(_SSID);
WiFi.begin(_SSID, _PASSWORD);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print("-");
}
Serial.println("");
Serial.println("WiFi Connected");
// Print the IP address
Serial.print("Use this URL to connect: ");
Serial.print("http://");
Serial.print(WiFi.localIP());
Serial.println("/");
digitalWrite(LED_BUILTIN, HIGH);
}
void loop() {
analogRead(sensorpin);
if (analogRead(sensorpin)>750) {
webhook.trigger();
}
delay(36000000);
}
Help or advice is very much appreciated.