Hi! I've been trying to get this to work for way to long so I hope someone in here can help. I have a nodemcu esp8266 with someone else's code I found in a tutorial which seems to work for everyone else somehow. Everything compiles and uploads fine, the board connects fine, the pin is right, the app name is correct, but it doesn't connect to the site and so it never triggers the event. I have digital 5 pulled down to ground if that helps but i doubt that's the problem. Heres my code. thanks!
//Code for the www.MakeUseOf.com Wi-Fi connected Button tutorial by Ian Buckley
#include <IFTTTWebhook.h>
#include <ESP8266WiFi.h>
#define ssid "FastDolphin"
#define password "removed"
#define IFTTT_API_KEY "removed"
#define IFTTT_EVENT_NAME "boiler"
void setup() {
Serial.begin(115200);
while(!Serial) {
}
Serial.println(" ");// print an empty line before and after Button Press
Serial.println("Button Pressed");
Serial.println(" ");
connectToWifi();
IFTTTWebhook hook(IFTTT_API_KEY, IFTTT_EVENT_NAME);
hook.trigger();
Serial.println("hook was triggered");
}
void connectToWifi() {
Serial.print("Connecting to: NAME "); //uncomment next line to show SSID name
//Serial.print(ssid);
WiFi.begin(ssid, password);
Serial.println(" ");
Serial.print("Attempting to connect: ");
//try to connect for 10 seconds
int i = 10;
while(WiFi.status() != WL_CONNECTED && i >=0) {
delay(1000);
Serial.print(i);
Serial.print(", ");
i--;
}
Serial.println(" ");
//print connection result
if(WiFi.status() == WL_CONNECTED){
Serial.print("Connected.");
Serial.println(" ");
Serial.print("NodeMCU ip address: ");
Serial.println(WiFi.localIP());
}
else{
Serial.println("Connection failed - check your credentials or connection");
}
}
void loop(){
}