ESP32 Network(WiFi) Example

For general Flowcode discussion that does not belong in the other sections.
Post Reply
User avatar
p.erasmus
Posts: 434
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

ESP32 Network(WiFi) Example

Post by p.erasmus »

Dear Team

I was looking in the wiki at the ESP WLAN component for a simple example it seems there is not an example.

I would like to set the ESP up as a server (not web server)and connect the Wifi to a Labview client(TCP) program over wifi on the local network
I am not sure if I should use the network componet plus the Wlan component ,
I noticed that both network component and Wlan component can open and close and read /write to a socket sorry for my ignorance but can you guys
help to understand what I need in components and get it connected to the Router and open a socket and wait for requests from client .
when to use Network component plus Wlan component and when to use only Wlan component is another confusion for me :oops:

As always any help is appreciated

P2.jpg
P2.jpg (13.06 KiB) Viewed 6094 times
Regards Peter - QME Electronics

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 686 times

Re: ESP32 Network(WiFi) Example

Post by BenR »

Hi Peter,

Sounds like a nice project, sorry for the delay I've been away on holiday this week.

Yes the ESP should be able to do this and hopefully we can provide you an example.

The ESP component provides it's own API so you can call the commands for this component directly.

The Network Comms component provides a general purpose API and so it works with multiple hardware specific targets such as the ESP. Therefore it adds a layer making it slightly less efficient but allowing you to move between hardware platforms and also allowing for library support such as the BBC weather, MQTT, Webserver or Modbus TCP etc.

I'll see if I can put together a server example for you.

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 686 times

Re: ESP32 Network(WiFi) Example

Post by BenR »

Here's hopefully a simple example for you to work with.
ESP32_Server_Example.fcfx
(17.95 KiB) Downloaded 713 times

User avatar
p.erasmus
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: ESP32 Network(WiFi) Example

Post by p.erasmus »

Hi Ben

Thanks a million this will get me going and up to :D :D :D speed

Appreciated
Regards Peter - QME Electronics

User avatar
p.erasmus
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: ESP32 Network(WiFi) Example

Post by p.erasmus »

Hi Ben,

Thank you again for the example it really helped me,I can connect sucessuflly to network and if I send I request from Labview I can see in LV also that the socket is open and the ESP32 is alive :D

A small issue I have connected a EB083 comboboard to the ESP and using the LCD :D Howver I expect something is not good/or me with the LCD timings
if I printstring "Hello client" just to test that that all is good with the LCD then the LCD print Hell------ all strange characters after the second L
if I print string "123456" it prints correctly :D
This is the generic 16x2 LCD component .

What I would like to do is after a successful conection is to read the IP and print to the LCD Connected and the IP: XXXXX what ever it is.
Just another question the ESP8266 Wlan component reads the IP and return a string and it seems the ESP32 Wlan component needs a byte index from a byte array and it will return the IP into the byte array , I tried this but with the LCD not working correctly it is hard to judge if I do this correctly

Thank so much again for your help
Regards Peter - QME Electronics

User avatar
p.erasmus
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: ESP32 Network(WiFi) Example

Post by p.erasmus »

Hi Ben.

I am connecting succesfully the wifi and I am sending and receiving data over the TCP LabView Client is all good it is just
my understanding from useing the Read IP macro where I have issue . Then also the LCD strange characters :D

Please help me understand how to get the IP string into the macro .
I will aprreciate it
Regards Peter - QME Electronics

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 686 times

Re: ESP32 Network(WiFi) Example

Post by BenR »

Hello Peter,

There was a bit of missing information there with the ReadIP function. I've now improved the tooltips and also provided a second component macro which is ReadIPAsString so this should do exactly what you require.

I'm pushing the change now and so it should be on the update system shortly.

User avatar
p.erasmus
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: ESP32 Network(WiFi) Example

Post by p.erasmus »

Thanks a million Ben
much appreciated :D :D
Regards Peter - QME Electronics

Post Reply