Page 1 of 1

ESP32 Network(WiFi) Example

Posted: Mon Aug 23, 2021 10:18 am
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 6114 times

Re: ESP32 Network(WiFi) Example

Posted: Wed Aug 25, 2021 4:43 pm
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.

Re: ESP32 Network(WiFi) Example

Posted: Wed Aug 25, 2021 4:59 pm
by BenR
Here's hopefully a simple example for you to work with.
ESP32_Server_Example.fcfx
(17.95 KiB) Downloaded 714 times

Re: ESP32 Network(WiFi) Example

Posted: Wed Aug 25, 2021 5:50 pm
by p.erasmus
Hi Ben

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

Appreciated

Re: ESP32 Network(WiFi) Example

Posted: Fri Aug 27, 2021 6:18 am
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

Re: ESP32 Network(WiFi) Example

Posted: Mon Aug 30, 2021 5:23 am
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

Re: ESP32 Network(WiFi) Example

Posted: Tue Aug 31, 2021 11:54 am
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.

Re: ESP32 Network(WiFi) Example

Posted: Tue Aug 31, 2021 1:24 pm
by p.erasmus
Thanks a million Ben
much appreciated :D :D