Disconnect from wifi Arduino R4

Hi. I have simple question.
How do I disconnect the Arduino R4 from a wifi connection?
Thanks.

Should be:
WiFi.disconnect();

Hi.
Have you ever tried it? It does not work for me.

WiFi - WiFi.disconnect()

Description

Disconnects the WiFi shield from the current network.

It says it disconnects from the "WiFi shield", not the R4.

Not on the R4.
That is why I said "should".

Edit: Give me a hint. What .h file are you using in your sketch?
I found one library. CWifi.disconnect() should work.

I am using WiFiS3.h

Try
CWiFi.disconnect();

Edit: WiFi.disconnect() should have worked with that library.

When I use Wifi.Disconnect, absolutely nothing happens. All I have to to is put it in the code correct? it does not require any extra coding? The code does not give any errors when compiling, but it does not disconnect the wifi connection.

When I use CWiFi.disconnect(); I get this error: Compilation error: expected unqualified-id before '.' token

Watch the case. Did you mean
WiFi.Disconnect()
or
WiFi.disconnect()
One will work. The other will not.

I used the right case. I just typed out a response quickly.

Just checking.
WiFi.disconnect() returns a value according to the library.
1 on success.
0 on fail
The function is in the link above in /src/WiFi.cpp at line 191.
Don't know anything about the modem deal in that function.

WiFi.disconnect();
if(status != WL_CONNECTED) {digitalWrite(LED_BUILTIN, LOW);}

I use the built in LED light to indicate whether the connection stopped or not, besides that, I am trying to connect to a new wifi network, and it doesnt work, so I know its still connected to the same network.

Try this on the disconnect:

if(WiFi.disconnect()) {
   Serial.println("disconnected");
} else {
   Serial.println("disconnect failed");
}

My findings:
Wifi.disconnect() was working all along, it appears that (status != WL_CONNECTED) does not change when the wifi is disconnected, so the LED light does not change. Your input has really helped. I have to figure out why (status != WL_CONNECTED) stays the same. Any ideas?

I think the problem might be the Bluetooth. The BLE and WIFI uses the same antenna, maybe (status != WL_CONNECTED) is the status of any connection to either. I am manipulating the R4 while connected via Bluetooth.

Hi again.
Ended up using: if( WiFi.status() == 3 ) to indicatate a successful wifi connection, and
if( WiFi.status() != 3 ) to tell when the Wifi is disconnected. "status" variable did not change status once it connected to a wifi network.

Thanks again for your help SurferTim.