ESP32 conneted WIFI to SMARTPHONE ....Mystery !!!

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
ixbo
Posts: 36
Joined: Wed May 04, 2022 11:12 am
Location: France

ESP32 conneted WIFI to SMARTPHONE ....Mystery !!!

Post by ixbo » Mon Jun 20, 2022 9:48 am

Hello
An other mystery I try this program to scan wifi , i'm in the nature connected
to nothing,only my smartphone.
My smartphone (SAMSUNG S9) is configured as acces point to INTERNET.

Code: Select all

sta_if = network.WLAN(network.STA_IF)
    
if sta_if.isconnected():
    print("     IP               MASQ           GATEWAY        DNS       ")
    print(sta_if.ifconfig())

nearby= sta_if.scan()
print("Liste des reseaux WIFI")

for j in nearby:
    print("Nom reseau: ",j[0])
    print("SSID: ",j[1])
    print("Canal: ",j[2])
    print("RSSI (db): ",j[3])
    print("Autorisation: ",j[4])
    print(sta_if.ifconfig())[color=#008000][/color]
This program work without PASSWORD AND
without SSID

>>> %Run -c $EDITOR_CONTENT
IP MASQ GATEWAY DNS
('192.168.43.85', '255.255.255.0', '192.168.43.1', '192.168.43.1')
Liste des reseaux WIFI
Nom reseau: b'AndroidAP46E7'
SSID: b'n\xc7\xec;F\xe7'
Canal: 6
RSSI (db): -34
Autorisation: 3
('192.168.43.85', '255.255.255.0', '192.168.43.1', '192.168.43.1')
>>>


I don't know why
I have an other program witch send data to THINGSPEAK ,working well at home connected to a Box, it seem working well connected to smartphone but nothing is send to the cloud !!!

Maybe there's someone who could explain me ???
Thanks very much

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: ESP32 conneted WIFI to SMARTPHONE ....Mystery !!!

Post by jimmo » Mon Jun 20, 2022 11:25 am

ixbo wrote:
Mon Jun 20, 2022 9:48 am
Maybe there's someone who could explain me ???
Thanks very much
Sorry I'm not quite sure I understand your question...

Your device is connected, and it's listing scan results. What were you expecting to see?

ixbo
Posts: 36
Joined: Wed May 04, 2022 11:12 am
Location: France

Re: ESP32 conneted WIFI to SMARTPHONE ....Mystery !!!

Post by ixbo » Mon Jun 20, 2022 3:08 pm

Hello thanks for your answer.....

I'm not sure but I will explain ...

I have a program named "main.py" loaded in my device This program can connect to my smartphone as box wifi
SSID and PASSWORD are needed ......,
When I power my ESP32 the main program start and WIFI is configured.....But now I create an other program with THONNY witch also use the same wifi connection
I run it with the Run bottom on THONNY .....i remark that PASSWORD and SSID are not needed.....
The reason is that my device is not reseted when running an other program, parameters created by the main program are always present
It's not the same logic what I'm used when programming MICROCHIP ....in ASSEMBLER

Thanks very much......very nice
Best regards

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: ESP32 conneted WIFI to SMARTPHONE ....Mystery !!!

Post by jimmo » Tue Jun 21, 2022 12:12 am

ixbo wrote:
Mon Jun 20, 2022 3:08 pm
But now I create an other program with THONNY witch also use the same wifi connection
The WiFi system on ESP32 runs somewhat independently of MicroPython. Unless you do a full reset, it will stay connected. Thonny is only doing a soft reset (which only restarts the Python VM).

Post Reply