This example shows how to switch the WIFI module on/off and set the bootmode of the module
The WIFI_EN_PIN is switching the module on/off (high=on, low=off)
Pin 13 is setting the bootmode of the module (high=normal mode, low=flashing mode). This pin is pulled high so it´s usually not necessary to include this pin in your code.
void setup() {
pinMode(2, OUTPUT); //LED is connected to Pin2
pinMode(WIFI_EN_PIN, OUTPUT); //This pin controls the power of the WIFI module (HIGH = ON)
pinMode(13, OUTPUT); //This pin sets the WIFI mode, 0 = flashmode, 1 = normal mode
//Preparing Wifi-module
digitalWrite(WIFI_EN_PIN, LOW); //turns WIFI module off
pinMode(13, OUTPUT); //set module to normal mode
delay(100); // wait a short time
digitalWrite(WIFI_EN_PIN, HIGH); //turns WIFI module on
}
void loop() {
}