Mkr 1010 led lampeggiante arancione

Salve, sto utilizzando Arduino mkr1010 come web-server connesso alla wi-fi. Il problema che ho rilevato è che alimentandolo direttamente con caricatore tipo smartphone da presa di corrente, inizialmente funziona bene, ma dopo circa un paio di ore la pagina web non è più raggiungibile e c'è un led arancione vicino alla presa usb che lampeggia. Dal pin out della scheda leggo che il pin in questione dovrebbe riguardare la batteria esterna Li Po. Qualcuno ha avuto un problema simile o potrebbe consigliarmi ?

Relativamnete al LED che lampeggia dopo un certo tempo, se è come per la MKR1000, allora ...

There are several occasions where this LED will start to blink at a frequency of about 2Hz. This flashing is caused by the following conditions maintained for a long time (from 20 to 70 minutes):- No battery is connected to JST connector.-

... relativamnete al problema della disconnessione .... bisogna vedere il codice.

Guglielmo

Appena posso posto il codice

Ieri sera dopo aver scritto questo post, ho tolto l' alimentazione al mio mkr1010 e poi lo ho ricollegato all' alimentazione, alimentandolo sempre con lo stesso caricatore da smartphone a 5V. Non so per quale motivo ma sono circa 20 ore che la pagina web è attiva e lo sketch mi sembra che giri correttamente, però la luce arancione continua a lampeggiare.

Può essere che per qualche motivo la scheda si era "inizializzata male" ?

Quindi se tutto gira correttamente il led si accenderebbe perché Arduino è alimentato per lungo tempo senza batteria ?

Posto lo sketch nel caso ci sia qualcosa che non va bene proprio nello sketch

#include <WiFiNINA.h>
#include "arduino_secrets.h";//includo libreria creata in nuovo tab a dx
      
WiFiServer server(80);            //server socket


WiFiClient client = server.available();


int ledPin = 2;


void setup() {
 Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
 // while (!Serial);
  
  enable_WiFi();
  connect_WiFi();


  server.begin();
  printWifiStatus();


}


void loop() {
  
 client = server.available();
    
if(client){
  
    printWEB();
}


 else{
 reconnect_WiFi();




 }






}


void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());


  // print your board's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);


  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");


  Serial.print("To see this page in action, open a browser to http://");
  Serial.println(ip);
}


void enable_WiFi() {
  // check for the WiFi module:
  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");
    // don't continue
    while (true);
  }


  String fv = WiFi.firmwareVersion();
  if (fv < "1.0.0") {
    Serial.println("Please upgrade the firmware");
  }
}


void connect_WiFi() {
  // attempt to connect to Wifi network:
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    WiFi.begin(ssid, pass);


    // wait 10 seconds for connection:
    delay(10000);
  }
}


void reconnect_WiFi() {
 int Max_Test  = 0;
 while((WiFi.status()!=WL_CONNECTED)&& (Max_Test<5)){
  Serial.print("Attendi riconnessione WiFi : ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
     WiFi.begin(ssid, pass);


    // wait 10 seconds for connection:
    delay(10000); 
    Max_Test++;
 }
  
}






void printWEB() {


  if (client) {                             // if you get a client,
    Serial.println("new client");           // print a message out the serial port
    String currentLine = "";                // make a String to hold incoming data from the client
    while (client.connected()) {            // loop while the client's connected
      if (client.available()) {             // if there's bytes to read from the client,
        char c = client.read();             // read a byte, then
        Serial.write(c);                    // print it out the serial monitor
        if (c == '\n') {                    // if the byte is a newline character


          // if the current line is blank, you got two newline characters in a row.
          // that's the end of the client HTTP request, so send a response:
          if (currentLine.length() == 0) {


            // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
            // and a content-type so the client knows what's coming, then a blank line:
            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println();
           
            //create the buttons
            client.print("<font color=#00a800><body style=background-color:#ffffff><center><h1><font size=+4>ARDUINO</span>


</h1></font>");
            client.print("<Center><p1><font color=black><font size=+2>Clicca  <a href=\"/H\">qui</a> per accendere il led<center>

");
            client.print("Clicca <a href=\"/L\">qui</a> per spegnere il led</font>







");
            
            int statoled = digitalRead(2);
            client.print("<font size=+2>IL LED E'  ");
            
            if (statoled==0){
              
              client.print("SPENTO");
            }
            if (statoled==1) {
              client.print("<font color=red> ACCESO");
            }
           
           
           
            
            


            // The HTTP response ends with another blank line:
            client.println();
            // break out of the while loop:
            break;
          }
          else {      // if you got a newline, then clear currentLine:
            currentLine = "";
          }
        }
        else if (c != '\r') {    // if you got anything else but a carriage return character,
          currentLine += c;      // add it to the end of the currentLine
        }


        if (currentLine.endsWith("GET /H")) {
        digitalWrite(ledPin, HIGH);        
        }
        if (currentLine.endsWith("GET /L")) {
        digitalWrite(ledPin, LOW);       
        }


      }
    }
    // close the connection:
    client.stop();
    Serial.println("client disconnected");
  }
}

tonio5:
Quindi se tutto gira correttamente il led si accenderebbe perché Arduino è alimentato per lungo tempo senza batteria ?

Si, è cosa prevista come ti ho riportato dal reference della MKR1000 WiFi.

Guglielmo

Dopo circa 40 ore va tutto bene, led arancione a parte, che quindi è normale che lampeggi. Vi aggiorno nel caso ci fosse un malfunzionamento. Grazie