BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Dynamically changing Wifi credentials withou hardcoring

I am aware of the WiFiManager and I tried it, my problem is that I cant apply it when using blynk because it keeps giving errors and I dont want to dynamically change the blynk auth token, just the WiFi credentials, so if you know the code, Ill be grateful (I`m using NodeMcu esp8266)
TIA

WiFiManager is perfectly capable of running with Blynk, either with or without a dynamically changed Auth code.

However, you might be better-off looking at some of the new alternative libraries that have been written by @khoih

https://community.blynk.cc/search?q=khoih%20user%3Akhoih%20%23supported-hardware%20WiFiManager

Pete.

1 Like

I got this code from a website and it works well… (its a door alarm security that sends a notification and email by Blynk when a door is opened) The problem is that I want to be able to change the wifi credentials dnamically, I know about the WiFiManager and I am able to use it seperatly but I cant combine the two codes as Im not a professional so please can you help me in using this code and be able to change the wifi credentials (WiFi credentials only not the blynk auth token) ? Im using Blynk on android 9, Node mcu esp8266.

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
BlynkTimer timer;
char auth[] = "xxxxx"; //Enter the authentication code sent by Blynk to your Email
char ssid[] = "xxxxx"; //Enter your WIFI SSID
char pass[] = "xxxxx"; //Enter your WIFI Password
int flag=0;



void notifyOnButtonPress()
{
  int isButtonPressed = digitalRead(D1);
  if (isButtonPressed==1 && flag==0) {
    Serial.println("Someone Opened the door");
    Blynk.notify("Alert : Someone Opened the door");
Blynk.email("xxxx@gmail.com", "ESP8266 Alert", "Someone Opened the Door");
    flag=1;
  }
  else if (isButtonPressed==0)
  {
    flag=0;
  }
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
pinMode(D1,INPUT_PULLUP);
timer.setInterval(16000L,notifyOnButtonPress); 
}
void loop()
{
  Blynk.run();
  timer.run();
}

TIA

@Wall-e I’ve merged your two topics together as they are about the same thing. Please keep discussions about the same topic together.

Pete.

1 Like

okay no problem, soo do you have any idea what I should do?

The bottom line is that you need to become more proficient at C++ coding, and probably the best way of doing that is trial and error, with some support.

Post the code that you’ve created, along with details of what does and doesn’t work, and people will probably chip-in with advice.

Pete.