I have a MKR1000 project that connects to my WiFi network. The MKR1000 connects to my WiFi when powered via the USB port, but not when powered by the 3.7V LiPo. Is there a minimum power requirement that disallows the WiFi function when on battery power, or is there some other reason it's not working?
Here is a simple sketch I'm using to test; it connects when plugged in to the USB, but not when unplugged.
#include <WiFi101.h>
#include "Mkr.h"
int wifiStatus = WL_IDLE_STATUS;
char ssid[] = SECRET_SSID;
char pass[] = SECRET_PASS;
IPAddress localip;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
//Serial.println();
ConnectToWifi();
//Serial.println(wifiStatus);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
void ConnectToWifi() {
wifiStatus = WiFi.status();
int retrys = 10;
while (wifiStatus != WL_CONNECTED) {
wifiStatus = WiFi.begin(ssid, pass);
delay(1000);
if (wifiStatus != WL_CONNECTED) {
retrys--;
if (retrys < 0)
{
retrys = 10;
delay(3600000);
}
delay(9000);
}
}
localip = WiFi.localIP();
//Serial.print("Connected: ");
//Serial.println(localip);
}