[Newbie] App suddenly not triggered pins anymore

Hi!

I got an NodeMCU and a 4 port relay connected to my electric triggered fireplace, it worked like a charm but all of sudden it stopped working and I am a bit lost why. Maybe there is somebody here that has an idea what is going wrong.

So i have an app that when triggering a virtual pin, changes the signal from HIGH to LOW on a few pins and after a second sets them back, connected some LEDs as a test setup, push the V1 button, D5 and D7 go out for a second and back. Now a week later, try to do the same, nothing happens. See the code below:


/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "authtoken";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "ssidgoeshere";
char pass[] = "passgoeshere";

boolean running = false; //Is app running?

BlynkTimer timerV1;
BlynkTimer timerV2;
BlynkTimer timerV3;
BlynkTimer timerV4;

void setup()
{
  // Debug console
  Serial.begin(9600);

  //-------( Initialize Pins so relays are inactive at reset)----
  digitalWrite(D5, HIGH);
  digitalWrite(D6, HIGH);
  digitalWrite(D7, HIGH);  
  
//---( THEN set pins as outputs )----  
  pinMode(D5, OUTPUT);   
  pinMode(D6, OUTPUT);  
  pinMode(D7, OUTPUT);   
  delay(4000); //Check that all relays are inactive at Reset

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
}

void fireplaceOnEndPulse()
{
  Serial.println("V1 fireplaceOnEndPulse");
  digitalWrite(D5, HIGH); // Activate relay
  digitalWrite(D7, HIGH); // Activate relay
  running = false;
}

void fireplaceOffEndPulse()
{
  Serial.println("V2 fireplaceOffEndPulse");
  digitalWrite(D5, HIGH); // Activate relay
  digitalWrite(D6, HIGH); // Activate relay
  digitalWrite(D7, HIGH); // Activate relay
  running = false;
}

void fireplaceUpEndPulse()
{
  digitalWrite(D5, HIGH); // Activate relay
  running = false;
}

void fireplaceDownEndPulse()
{
  digitalWrite(D7, HIGH); // Activate relay
  running = false;
}

BLYNK_WRITE(V1)  // Virtual button on V1 to turn on the fireplace
{
  Serial.println("V1 Triggered");
  int RLY1 = param.asInt();
  if (RLY1 == 1 && !running)
  {
    running = true;
    digitalWrite(D5, LOW); // Activate relay
    digitalWrite(D7, LOW); // Activate relay
    timerV1.setTimer(1050, fireplaceOnEndPulse, 1);  // Pulse Relay ON routine three times in 500ms
  } 
}

BLYNK_WRITE(V2)  // Virtual button on V2 to turn off the fireplace
{
  Serial.println("V2 Triggered");
  int RLY2 = param.asInt();
  if (RLY2 == 1 && !running)
  {
    running = true;
    digitalWrite(D5, LOW); // Activate relay
    digitalWrite(D6, LOW); // Activate relay
    digitalWrite(D7, LOW); // Activate relay
    timerV2.setTimer(1050, fireplaceOffEndPulse, 1);  // Pulse Relay ON routine three times in 500ms
  } 
}

BLYNK_WRITE(V3)  // Virtual button on V3 to turn up the fireplace
{
  Serial.println("V3 Triggered");
  int RLY3 = param.asInt();
  if (RLY3 == 1 && !running)
  {
    running = true;
    digitalWrite(D5, LOW); // Activate relay
    timerV3.setTimer(1050, fireplaceUpEndPulse, 1);  // Pulse Relay ON routine three times in 500ms
  } 
}

BLYNK_WRITE(V4)  // Virtual button on V4 to turn down the fireplace
{
  Serial.println("V4 Triggered");
  int RLY4 = param.asInt();
  if (RLY4 == 1 && !running)
  {
    running = true;
    digitalWrite(D7, LOW); // Activate relay
    timerV4.setTimer(1050, fireplaceDownEndPulse, 1);  // Pulse Relay ON routine three times in 500ms
  } 
}

void loop()
{
  Blynk.run();
  timerV1.run();
  timerV2.run();
  timerV3.run();
  timerV4.run();      
}

To see if i fried the board with some faulty wiring or something in that area I also uploaded the simple blink sketch, works like a charm!


#define LED_PIN D5
void setup() {
  pinMode(LED_PIN, OUTPUT);     // Initialize the LED_BUILTIN pin as an output
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_PIN, LOW);   // Turn the LED on (Note that LOW is the voltage level
                                    // but actually the LED is on; this is because 
                                    // it is active low on the ESP-01)
  delay(1000);                      // Wait for a second
  digitalWrite(LED_PIN, HIGH);  // Turn the LED off by making the voltage HIGH
  delay(2000);                      // Wait for two seconds (to demonstrate the active low LED)
}

Anybody has any idea what is going on here?

Thanks for your time already!

I believe that you get disconnected from Blynk. Check this post and you’ll get it running again: [SOLVED] How to run Blynk.run() only when WiFi connection is established

Oh, and you don’t need to declare 4 different timers… you can attach 10 functions to one…