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

Autoconnect Blynk (WifiManager Alternative) - ESP8266/ESP32

@Nilava_Chowdhury hi
I just tried you example today but I need to know what I should write in “declarations.h” (the Format)

// ==========================================
// All Blynk settings goes in here
// ==========================================

//Config Blynk structure
struct BlynkConfig {
  String devicename;
  String blynkServer;
  String blynkPort;
  String blynkToken;
};

const char *fileName = "/config.txt";  // filename of config file.
BlynkConfig blynkconfig;                   // global configuration object

int port;
IPAddress ip;

I am using “blynk-cloud.com” and port 80

I’ve not tried this software library, but I did have a quick look at the code.
My thoughts are this is where you define the custom fields that will appear in the captive portal, so in this case there would be fields allowing you to input a device name (presumably for OTA) and the Blynk server, port and Auth code.

So, as the OP said, this SHOULD work as it stands and you’ll then get captive portal fields to allow you to add your Blynk related credentials.

As I said, I’ve not tried it.

Pete.

Good morning @PeteKnight
as you know I am not a coder
after compiling the sketch I am receiving this error

In file included from C:\Users\------------\main.ino:19:0:
sketch\webpages.h: In function 'String saveDone(AutoConnectAux&, PageArgument&)':
webpages.h:150: error: cannot convert 'String' to 'AutoConnectAux*' in initialization
   AutoConnectAux*   blynk_setting = portal.where();

exit status 1
cannot convert 'String' to 'AutoConnectAux*' in initialization


I really don’t know what I am missing.


same error was posted here by @Brummer but no reply from @Nilava_Chowdhury

Not sure. As I said, I’ve never tried the software.
If I get chance I’ll give it a try later, but I’m quite busy at the moment :slightly_smiling_face:

The OP was last seen on 22nd April.

Pete.

I installed the libraries and tried to compile the code and get exactly the same error message.

Pete.

Sorry guys, i had been busy with my exams, i tried out the code, the issue is with the latest library, i need to make changes for the latest library, in the mean time you guys can try with arduino json v5 and it should work perfect!
@PeteKnight @Ze_Pico

Arduino Json V6 causes another error message. Downgrading to v5 eliminates that message, but then results in this compiler error:

error: cannot convert ‘String’ to ‘AutoConnectAux*’ in initialization
AutoConnectAux* blynk_setting = portal.where();

Pete.

Use AutoConnect library version 0.9.7

How can I use this with the ESP32 instead of the ESP8266? I am not that great at coding.

It compiles correctly when using v0.9.7 :slightly_smiling_face:

Pete.

1 Like

According to the documentation, it should automatically detect that an ESP32 is being used.

Pete.

Phew! I will update my code to work with latest version when i have time. Or maybe it won’t be necessary when new blynk comes, let’s see what features will be made free for the community.

Yes the Library Worked with the ESP32 but I was referring to the Example Provided. Its written for the 8266.

Well, the example sketch contains this code:

// Adjusting WebServer class with between ESP8266 and ESP32.
ESP8266WebServer  webServer;
AutoConnect  portal(webServer);
AutoConnectConfig config;

I’ve not tried it with either an ESP8266 or ESP32, have you?

Pete.

Still getting another Error :face_with_raised_eyebrow:
after
ArduinoJson v5
AutoConnect library version 0.9.7

sketch\filehandeling.h:4:2: error: expected initializer before 'bool'
bool saveConfiguration(const char *filename, const BlynkConfig &saveconfig) {`
  • Using PlatformIO every thing went fine compiling and uploading (without errors)

but here what you get on the "Serial Monitor"

@Nilava_Chowdhury May be you should revise your code.

ctx: cont
sp: 3ffffda0 end: 3fffffc0 offset: 01a0
3fffff40:  3ffefdf0 3ffefcf4 3fff01bc 402032e6
3fffff50:  00000000 00000000 ff21da94 4021da74
3fffff60:  00000000 00000000 ff000000 00000000
3fffff70:  00000000 ffefeffe feefeffe feefeffe
3fffff80:  feefeffe feefeffe feefeffe feefeffe
3fffff90:  feefeffe feefeffe feefeffe 3fff02dc
3fffffa0:  3fffdad0 00000000 3fff02ac 40213bd4
3fffffb0:  feefeffe feefeffe 3ffe8558 40100591
<<<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

Mounting FS...
Failed to read file, using default configuration
Valid config file.
Config read
Print config file after reading...
Failed to read file
APID : ESP-b2e4e9
[AC] Element<caption1> not registered
[AC] caption1<7> of /Settings created
[AC] *noname placed on /Settings
[AC] caption1<7> of /Settings loaded
[AC] Element<caption2> not registered
[AC] caption2<7> of /Settings created
[AC] *noname placed on /Settings
[AC] caption2<7> of /Settings loaded
[AC] Element<blynkserver> not registered
[AC] blynkserver<3> of /Settings created
[AC] *noname placed on /Settings
[AC] blynkserver<3> of /Settings loaded
[AC] Element<blynkport> not registered
[AC] blynkport<3> of /Settings created
[AC] *noname placed on /Settings
[AC] blynkport<3> of /Settings loaded
[AC] Element<blynktoken> not registered
[AC] blynktoken<3> of /Settings created
[AC] *noname placed on /Settings
[AC] blynktoken<3> of /Settings loaded
[AC] Element<devicename> not registered
[AC] devicename<3> of /Settings created
[AC] *noname placed on /Settings
[AC] devicename<3> of /Settings loaded
[AC] Element<save> not registered
[AC] save<6> of /Settings created
[AC] *noname placed on /Settings
[AC] save<6> of /Settings loaded
[AC] Element<discard> not registered
[AC] discard<6> of /Settings created
[AC] *noname placed on /Settings
[AC] discard<6> of /Settings loaded
[AC] /Settings on hands
[AC] Element<caption> not registered
[AC] caption<7> of /savedone created
[AC] *noname placed on /savedone
[AC] caption<7> of /savedone loaded
[AC] Element<parameters> not registered
[AC] parameters<7> of /savedone created
[AC] *noname placed on /savedone
[AC] parameters<7> of /savedone loaded
[AC] Element<settings> not registered
[AC] settings<6> of /savedone created
[AC] *noname placed on /savedone
[AC] settings<6> of /savedone loaded
[AC] Element<clear> not registered
[AC] clear<6> of /savedone created
[AC] *noname placed on /savedone
[AC] clear<6> of /savedone loaded
[AC] /savedone on hands
[AC] Element<caption> not registered
[AC] caption<7> of /discard created
[AC] *noname placed on /discard
[AC] caption<7> of /discard loaded
[AC] Element<settings> not registered
[AC] settings<6> of /discard created
[AC] *noname placed on /discard
[AC] settings<6> of /discard loaded
[AC] /discard on hands
[AC] SoftAP configure 192.168.244.1, 192.168.244.1, 255.255.255.0

@PeteKnight this is what @Rizqi_Ari_Putra was showing in his post.

also here are the Warnings


In file included from src\main.cpp:8:0:
C:\Users\----\.platformio\lib\Blynk_ID415\src/BlynkSimpleEsp8266.h: In member function 'void BlynkWifi::connectWiFi(const char*, const char*)':
C:\Users\----\.platformio\lib\Blynk_ID415\src/BlynkSimpleEsp8266.h:54:19: warning: variable 'myip' set but not used [-Wunused-but-set-variable]
         IPAddress myip = WiFi.localIP();
                   ^
In file included from src\main.cpp:18:0:
src\filehandeling.h: In function 'bool loadConfiguration(const char*, BlynkConfig&)':
src\filehandeling.h:76:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
In file included from src\main.cpp:19:0:
src\webpages.h: In function 'String saveDone(AutoConnectAux&, PageArgument&)':
src\webpages.h:150:21: warning: unused variable 'blynk_setting' [-Wunused-variable]
   AutoConnectAux*   blynk_setting = portal.where();
                     ^
In file included from src\main.cpp:18:0:
src\filehandeling.h: In function 'bool saveConfiguration(const char*, const BlynkConfig&)':
src\filehandeling.h:42:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
src\filehandeling.h: In function 'bool printFile(const char*)':
src\filehandeling.h:98:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^



lib\PubSubClient\src\PubSubClient.cpp: In member function 'boolean PubSubClient::beginPublish(const char*, unsigned int, boolean)':
lib\PubSubClient\src\PubSubClient.cpp:456:18: warning: unused variable 'i' [-Wunused-variable]
         uint16_t i;
                  ^

Yes there are warnings, but it should work, i will have to rewrite it from the beginning as the library changed quite a lot. I will try to rewrite and upload new code.

If you wanna try out yourself i mentioned the library link in the post you can see the examples in his repo.

Library - AutoConnect Library

yes, and I am using the AutoConnect library version 0.9.7 as you mentioned.
about the examples in the repo are a bit difficult for me because I am not programmer .
I will wait your new code.
thanks

The code compiled without warnings, but when uploaded the device gives constant WDT resets.

Pete.

A post was split to a new topic: Wi-Fi Manager problem with ESP32