B4R Question WIFI OFF (sleep) and after 60 second WIFI ON, with ESP8266 + change WifiPower

petr4ppc

Well-Known Member
Licensed User
Longtime User
Dear friends, I am using ESP8266MOD

my code:

B4X:
Dim ota As ESP8266OTA
Private esp As ESP8266extras
Private wifi As ESP8266WiFi

If wifi.IsConnected=True Then
    wifi.Disconnect
    If esp.WIFI_MODE_STA=True Then esp.SetWifiMode(esp.WIFI_MODE_OFF)  ' **** here is my mistake
    Log("go sleep")
End If
                                      
Delay(60000)                                     
                                      
esp.SetWifiMode(esp.WIFI_MODE_STA)
esp.SetPower(18)
Log("wake up")

but I get:

the reason of mistake is: esp.SetPower(18)

- I need activate some "sleep wifi mode" for 1 minute, but without connecting GPIO16 pin to RST pin and set power to 18.
- I need recognize state: "If esp.WIFI_MODE_STA=True"

Please very much for help
Best regards
p4ppc
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…