Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By tmorford
#50570 Hello all I am running a NodeMCU that when I put it in light sleep mode the power consumption is the same as if it was in running mode not sure what I am doing wrong? My code is :

Code: Select allvoid sleep()
{
  Serial.println("Sleep");
  wifi_fpm_set_sleep_type(LIGHT_SLEEP_T);
  wifi_fpm_open();
  gpio_pin_wakeup_enable(GPIO_ID_PIN(VIB_PIN), GPIO_PIN_INTR_LOLEVEL);
  wifi_fpm_do_sleep(0xFFFFFFF);
}

void setup() {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  Serial.println("Startup");
  pinMode(VIB_PIN, OUTPUT);
  sleep();
}

void loop() {
  if(digitalRead(VIB_PIN) != HIGH)
  {
       int n =  WiFi.scanNetworks();
for (int i = 0; i < n; ++i)
    {
      // Print SSID and RSSI for each network found
      Serial.print(i + 1);
      Serial.print(": ");
      Serial.print(WiFi.SSID(i));
      Serial.print(" (");
      Serial.print(WiFi.RSSI(i));
      Serial.print(")");
      Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*");
      delay(10);
    }
  }
}


Running in sleep mode or in non-sleep mode is exactly the same amount of power not sure why.
Thanks!