Blynk Edgenet Configuration error

Hey, i’m having trouble with one of my projects. I was trying to build a home automation system which remembers the previous state in case of a power loss, but after uploading the code I’m not able to connect my Node MCU esp-12E with the blynk app.

#include <EEPROM.h>

#define BLYNK_TEMPLATE_ID "TMPLBzK5MDXo"
#define BLYNK_DEVICE_NAME "HomeUTOMATION"

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG

#define APP_DEBUG

// Uncomment your board, or configure a custom board in Settings.h
//#define USE_SPARKFUN_BLYNK_BOARD
#define USE_NODE_MCU_BOARD
//#define USE_WITTY_CLOUD_BOARD
//#define USE_WEMOS_D1_MINI

#include "BlynkEdgent.h"

int fan_Speed1 = HIGH;
int fan_Speed2 = HIGH;
int fan_Speed3 = HIGH;
int fan_Speed4 = HIGH;

int Speed1 = 14;
int Speed2 = 12;
int Speed3 = 4;
int Speed4 = 5;

int Speed1add = 1;
int Speed2add = 2;
int Speed3add = 3;
int Speed4add = 4;

BLYNK_WRITE(V12)
{
  fan_Speed1 = param.asInt(); // assigning incoming value from pin V1 to a variable
  digitalWrite(Speed1, fan_Speed1);
  EEPROM.write(Speed1add, fan_Speed1);
  EEPROM.commit();
}

BLYNK_WRITE(V13)
{
  fan_Speed2 = param.asInt(); // assigning incoming value from pin V1 to a variable
  digitalWrite(Speed2, fan_Speed2);
  EEPROM.write(Speed2add, fan_Speed2);
  EEPROM.commit();
}

BLYNK_WRITE(V14)
{
  fan_Speed3 = param.asInt(); // assigning incoming value from pin V1 to a variable
  digitalWrite(Speed3, fan_Speed3);
  EEPROM.write(Speed3add, fan_Speed3);
  EEPROM.commit();
}

BLYNK_WRITE(V15)
{
  fan_Speed4 = param.asInt(); // assigning incoming value from pin V1 to a variable
  digitalWrite(Speed4, fan_Speed4);
  EEPROM.write(Speed4add, fan_Speed4);
  EEPROM.commit();
}

void setup()
{
  EEPROM.begin(512);
  if (EEPROM.read(Speed1add) == 255)
  {
    fan_Speed1 = HIGH; //default turn off value for relay
  }
  else
  {
    fan_Speed1 = EEPROM.read(Speed1add);
  }
  if (EEPROM.read(Speed2add) == 255)
  {
    fan_Speed2 = HIGH;//default turn off value for relay
  }
  else
  {
    fan_Speed2 = EEPROM.read(Speed2add);
  }
  if (EEPROM.read(Speed3add) == 255)
  {
    fan_Speed3 = HIGH;//default turn off value for relay
  }
  else
  {
    fan_Speed3 = EEPROM.read(Speed3add);
  }
  if (EEPROM.read(Speed4add) == 255)
  {
    fan_Speed4 = HIGH;//default turn off value for relay
  }
  else
  {
    fan_Speed4 = EEPROM.read(Speed4add);
  }
  
  
  pinMode(Speed1, OUTPUT);
  pinMode(Speed2, OUTPUT);
  pinMode(Speed3, OUTPUT);
  pinMode(Speed4, OUTPUT);

  //TURN OFF all Relays on Start 
  digitalWrite(Speed1, fan_Speed1);
  digitalWrite(Speed2, fan_Speed2);
  digitalWrite(Speed3, fan_Speed3);
  digitalWrite(Speed4, fan_Speed4);

  Serial.begin(115200);

  Serial.println("Begin");
  
  delay(100);
  BlynkEdgent.begin();
}

void loop() {
  BlynkEdgent.run();
}

After Uploading the output is this

Begin
[621] Using default config.
[621] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_[621] Hold the button for 10 seconds to reset configuration...
//_/[627] Hold the button for 10 seconds to reset configuration...
_/\_\[633] Hold the button for 10 seconds to reset configuration...

   [639] Hold the button for 10 seconds to reset configuration...
     /[645] Hold the button for 10 seconds to reset configuration...
___/ [651] Hold the button for 10 seconds to reset configuration...
v[656] Hold the button for 10 seconds to reset configuration...
1.1.0 on [663] Hold the button for 10 seconds to reset configuration...
NodeM[669] Hold the button for 10 seconds to reset configuration...
CU[675] Hold the button for 10 seconds to reset configuration...


[680] Hold the button for 10 seconds to reset configuration...
[686] Hold the button for 10 seconds to reset configuration...

 #St[692] Hold the button for 10 seconds to reset configuration...
andWithUkrai[698] Hold the button for 10 seconds to reset configuration...
[704] Hold the button for 10 seconds to reset configuration...
ne[710] Hold the button for 10 seconds to reset configuration...
[715] Hold the button for 10 seconds to reset configuration...
  [721] Hold the button for 10 seconds to reset configuration...
  [727] Hold the button for 10 seconds to reset configuration...
[732] Hold the button for 10 seconds to reset configuration...
h[738] Hold the button for 10 seconds to reset configuration...
ttps[744] Hold the button for 10 seconds to reset configuration...
:[749] Hold the button for 10 seconds to reset configuration...
//bit.ly/[756] Hold the button for 10 seconds to reset configuration...
swua
[762] Hold the button for 10 seconds to reset configuration...


[[768] Hold the button for 10 seconds to reset configuration...
768] [774] Hold the button for 10 seconds to reset configuration...
-----[780] Hold the button for 10 seconds to reset configuration...
--------------[787] Hold the button for 10 seconds to reset configuration...
[792] Hold the button for 10 seconds to reset configuration...
--[798] Hold the button for 10 seconds to reset configuration...
---[804] Hold the button for 10 seconds to reset configuration...
--
[81[810] Hold the button for 10 seconds to reset configuration...
0[815] Hold the button for 10 seconds to reset configuration...
] Pro[821] Hold the button for 10 seconds to reset configuration...
duct:  Ho[828] Hold the button for 10 seconds to reset configuration...
meUTO[834] Hold the button for 10 seconds to reset configuration...
MATION[840] Hold the button for 10 seconds to reset configuration...

[[846] Hold the button for 10 seconds to reset configuration...
846] Fi[852] Hold the button for 10 seconds to reset configuration...
rmwar[858] Hold the button for 10 seconds to reset configuration...
e:[864] Hold the button for 10 seconds to reset configuration...
 0.1.0 [870] Hold the button for 10 seconds to reset configuration...
(build[876] Hold the button for 10 seconds to reset configuration...
 Au[882] Hold the button for 10 seconds to reset configuration...
g 2[887] Hold the button for 10 seconds to reset configuration...
2 [893] Hold the button for 10 seconds to reset configuration...
2[899] Hold the button for 10 seconds to reset configuration...
02[904] Hold the button for 10 seconds to reset configuration...
2 18:15:18)
[[911] Hold the button for 10 seconds to reset configuration...
9[917] Hold the button for 10 seconds to reset configuration...
1[923] Hold the button for 10 seconds to reset configuration...
1] Device[929] Hold the button for 10 seconds to reset configuration...
:   N[935] Hold the button for 10 seconds to reset configuration...
ode[941] Hold the button for 10 seconds to reset configuration...
MCU @ 80MHz
[9[948] Hold the button for 10 seconds to reset configuration...
47] [954] Hold the button for 10 seconds to reset configuration...
MA[959] Hold the button for 10 seconds to reset configuration...
C:[965] Hold the button for 10 seconds to reset configuration...
 [971] Hold the button for 10 seconds to reset configuration...
     84:C[977] Hold the button for 10 seconds to reset configuration...
C:A8:[983] Hold the button for 10 seconds to reset configuration...
86:57[989] Hold the button for 10 seconds to reset configuration...
:[994] Hold the button for 10 seconds to reset configuration...
42
[1[1001] Hold the button for 10 seconds to reset configuration...
000][1007] Hold the button for 10 seconds to reset configuration...
 
Exception (0):
epc1=0x4020101c epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

>>>stack>>>

ctx: cont
sp: 3ffffbf0 end: 3fffffc0 offset: 01a0
3ffffd90:  4010040a 00000000 00000000 40100490  
3ffffda0:  c0037030 00ff0000 ff000000 4100205d  
3ffffdb0:  00000000 3fff1c58 00000000 00000022  
3ffffdc0:  3fffc200 401003d0 3fffc258 4000050c  
3ffffdd0:  400046ea 00000030 0000001d ffffffff  
3ffffde0:  401048a3 00000000 00000000 00000001  
3ffffdf0:  04000001 04000001 3feffe00 00000100  
3ffffe00:  60000200 00000001 fffffffe 3fff0b58  
3ffffe10:  3fff0b38 3ffe8a9d 3fffff00 00000030  
3ffffe20:  3ffffed0 7fffffff 7ffffffd 3fff0b58  
3ffffe30:  00000031 0000000a 3fff0b58 4020e17c  
3ffffe40:  3ffffec0 4020f48c 3ffffebf 4020e531  
3ffffe50:  3ffffe8c feefeffe feefeffe 0000000a  
3ffffe60:  3ffe8b35 00000020 3ffffe8b 4020e837  
3ffffe70:  00000000 4bc6a7f0 da9fbe76 00000000  
3ffffe80:  3ffe866e 00000000 3ffe866d 402119f2  
3ffffe90:  00000000 3fff0b38 40100294 3fffff00  
3ffffea0:  3ffe8a9d 3fff0b38 3fff0b58 3fffff00  
3ffffeb0:  3fffff0c 0000000a 3fffff00 4020f50e  
3ffffec0:  3ffe866c 3fff0b38 3fffff00 4020f56c  
3ffffed0:  4010579e 4010576a 3fffff00 4020f708  
3ffffee0:  4020ddf8 0016405e 3fff0b58 4020f73c  
3ffffef0:  3ffe8a9a 3fff0b38 3fff0b58 402029bd  
3fffff00:  73616c46 20203a68 00002020 73616c46  
3fffff10:  20203a68 00002020 00000000 00000000  
3fffff20:  ff002020 3fff0b58 3fff0669 4020194c  
3fffff30:  40203e18 3fff0b58 3ffe84ec 3ffe8500  
3fffff40:  3ffe84fc 3fff0b58 3ffe84ec 4020400c  
3fffff50:  feefeffe feefeffe feefeffe feefeffe  
3fffff60:  feefeffe feefeffe feefeffe feefeffe  
3fffff70:  feefeffe feefeffe feefeffe feefeffe  
3fffff80:  feefeffe feefeffe feefeffe feefeffe  
3fffff90:  feefeffe feefeffe feefeffe 3fff0c88  
3fffffa0:  3fffdad0 00000000 3fff0c58 40210890  
3fffffb0:  feefeffe feefeffe 3ffe8580 40100885  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v8b899c12
~ld

Blynk Edgent uses EEPROM to store the Auth token and WiFi credentials, so there a good chance that you are overwriting that info with your EDPROM code - hence the constant request for you to clear tge EEPROM by pressing the button for 10 seconds then re-provision the device.

TBH, you’d probably be better storing the last state on te Blynk server then fetching this whth a Blynk.sync(vPin) command within a BLYNK_CONNECTED callback.

Pete.

So this is what you are suggesting

#define BLYNK_TEMPLATE_ID "TMPLBzK5MDXo"
#define BLYNK_DEVICE_NAME "HomeUTOMATION"

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG

#define APP_DEBUG

// Uncomment your board, or configure a custom board in Settings.h
//#define USE_SPARKFUN_BLYNK_BOARD
#define USE_NODE_MCU_BOARD
//#define USE_WITTY_CLOUD_BOARD
//#define USE_WEMOS_D1_MINI

#include "BlynkEdgent.h"

int fan_Speed1 = HIGH;
int fan_Speed2 = HIGH;
int fan_Speed3 = HIGH;
int fan_Speed4 = HIGH;

int Speed1 = 14;
int Speed2 = 12;
int Speed3 = 4;
int Speed4 = 5;

BLYNK_WRITE(V12)
{
  fan_Speed1 = param.asInt(); // assigning incoming value from pin V1 to a variable
  digitalWrite(Speed1, fan_Speed1);
}

BLYNK_WRITE(V13)
{
  fan_Speed2 = param.asInt(); // assigning incoming value from pin V1 to a variable
  digitalWrite(Speed2, fan_Speed2);
}

BLYNK_WRITE(V14)
{
  fan_Speed3 = param.asInt(); // assigning incoming value from pin V1 to a variable
  digitalWrite(Speed3, fan_Speed3);
}

BLYNK_WRITE(V15)
{
  fan_Speed4 = param.asInt(); // assigning incoming value from pin V1 to a variable
  digitalWrite(Speed4, fan_Speed4);
}

void setup()
{
  pinMode(Speed1, OUTPUT);
  pinMode(Speed2, OUTPUT);
  pinMode(Speed3, OUTPUT);
  pinMode(Speed4, OUTPUT);

  //TURN OFF all Relays on Start 
  digitalWrite(Speed1, fan_Speed1);
  digitalWrite(Speed2, fan_Speed2);
  digitalWrite(Speed3, fan_Speed3);
  digitalWrite(Speed4, fan_Speed4);

  Serial.begin(115200);

  Serial.println("Begin");
  
  delay(100);
  BlynkEdgent.begin();
}

void loop() {
  BlynkEdgent.run();
}

BLYNK_CONNECTED(){
  Blynk.syncAll();
  }

No, I said…

not

Pete.

I don’t understand can you please provide me with a code snippet with that implementation?
I’m Sorry I’m something of a beginner with blynk.

-edit-
Is This Right? If not can please provide me with the snippet

BLYNK_CONNECTED(){
  Blynk.syncVirtual(V12,V13,V14,V15);
}

BLYNK_WRITE(V12)
{
  fan_Speed1 = param.asInt(); // assigning incoming value from pin V1 to a variable
  digitalWrite(Speed1, fan_Speed1);
}

BLYNK_WRITE(V13)
{
  fan_Speed2 = param.asInt(); // assigning incoming value from pin V1 to a variable
  digitalWrite(Speed2, fan_Speed2);
}

BLYNK_WRITE(V14)
{
  fan_Speed3 = param.asInt(); // assigning incoming value from pin V1 to a variable
  digitalWrite(Speed3, fan_Speed3);
}

BLYNK_WRITE(V15)
{
  fan_Speed4 = param.asInt(); // assigning incoming value from pin V1 to a variable
  digitalWrite(Speed4, fan_Speed4);
}

Thank you

Does this actually work?

I’d have expected four lines of code, one for each vPin.

Pete.

Also, your approach seems rather clunky.
Why not use a segmented switch or a slider with values for each speed, then with a 0 value for off, or an on/off switch?

Pete.

Oh sorry if you misunderstood the code. I was reusing the code from one of my old legacy blynk projects which acted as a Speed Controller for my fan, but this one is for controling 4 different appliances. Because of this reuse the variable names can be a bit confusing.

Thank you though.

So this is the code to achieve what I’m trying to do?

BLYNK_CONNECTED(){
  Blynk.syncVirtual(V12);
  Blynk.syncVirtual(V13);
  Blynk.syncVirtual(V14);
  Blynk.syncVirtual(V15);
}

BLYNK_WRITE(V12)
{
  fan_Speed1 = param.asInt(); // assigning incoming value from pin V1 to a variable
  digitalWrite(Speed1, fan_Speed1);
}
..........