How to use WifiClient in esp32

#1

I see the example program already connected wifi network. How to use mqtt and webserver function? Because of the wifi object has been used.

#2

You can use wifi library.
When a device acquires an IP address, call mDashStart() function.

#3

How to use the following object after embed mDash core?

WiFiClient espClient;
PubSubClient client(espClient);

Any example for reference?

#4

mDash is just a library, so use it like any other library.
Think about that the other way around.
Build your sketch using WiFiClient and PubSubClient.
Then, add mDash to it - that could be done by sticking a single line with mDashStart() call into a right place.

Does that make sense?

#5

See https://github.com/cesanta/mDash/tree/master/examples/Minimal

#6

My device will sleep periodically. How can I check if FOTA occur and stop sleeping?

#7

Could you elaborate please?

#8

I can ugrade firmware but program sleep will stop the process of OTA. How to check ota is processing in program loop in arduino?

#9

Create a global variable int ota = 0;
Create a custom RPC function that changes that variable to 1.
Before upgrading your device, call that function to set the variable to 1.
In your Arduino loop, check the value of the variable.

#10

Understand thx.
Other questions, how the production occurs that each device use deferent keys and names? 100 device use 100 firmware?

#11

No. The firmware should be the same. WiFi config should reside in the config file. Please read the docs.

#12

When I change the project to platform IO, there is build error

.pio/build/esp32dev/src/main.cpp.o:(.literal._Z4loopv+0x15c): undefined reference to `mDashInit’

#13

Or Any tip to choose partitions scheme in VScode?