MKRfox 1200 compromesso irrimediabilmente?

Ciao a tutti, spero di non aver rovinato irrimediabilmente l'MKRfox 1200!

Ho caricato uno sketch in cui viene inviato un messaggio ogni 15 munuti, tra un messaggio e l'altro va in sleep utilizzando la libreria ArduinoLowPower

Purtroppo però ora non riesco a caricare più nessuno sketch perchè la scheda non è più visibile dall'IDE di Arduino!! Spero di non aver rovinato per sempre la scheda! :frowning:

Grazie a chi mi saprà aiutare!

questo è lo sketch

#include <ArduinoLowPower.h>
#include <SigFox.h>
#include "conversions.h"

// Set oneshot to false to trigger continuous mode when you finisched setting up the whole flow
int oneshot = false;

/*
    ATTENTION - the structure we are going to send MUST
    be declared "packed" otherwise we'll get padding mismatch
    on the sent data - see http://www.catb.org/esr/structure-packing/#_structure_alignment_and_padding
    for more details
*/
typedef struct __attribute__ ((packed)) sigfox_message {
  uint16_t temp;
  uint8_t lastMessageStatus;
} SigfoxMessage;

// stub for message which will be sent
SigfoxMessage msg;
float temperature = 0.0;

void setup() {

  if (oneshot == true) {
    // Wait for the serial
    Serial.begin(115200);
    while (!Serial) {}
  }

  if (!SigFox.begin()) {
    // Something is really wrong, try rebooting
    // Reboot is useful if we are powering the board using an unreliable power source
    // (eg. solar panels or other energy harvesting methods)
    reboot();
  }

  //Send module to standby until we need to send a message
  SigFox.end();

  if (oneshot == true) {
    // Enable debug prints and LED indication if we are testing
    SigFox.debug();
  }


}

void loop() {

  temperature = temperature + 11;
  msg.temp = convertoFloatToInt16(temperature, 100, -60);

  // Start the module
  SigFox.begin();
  // Wait at least 30ms after first configuration (100ms before)
  delay(100);

  // We can only read the module temperature before SigFox.end()
  

  

  // Clears all pending interrupts
  SigFox.status();
  delay(1);

  SigFox.beginPacket();
  SigFox.write((uint8_t*)&msg, 12);

  msg.lastMessageStatus = SigFox.endPacket();

 

  SigFox.end();

  if (oneshot == true) {
    // spin forever, so we can test that the backend is behaving correctly
    while (1) {}
  }

  //Sleep for 15 minutes
  LowPower.sleep(15 * 60 * 1000);
}

void reboot() {
  NVIC_SystemReset();
  while (1);
}

ciao

tu da gestione dispositivi vedi la porta COM dell'arduino??

MD

Ho risolto il Problema resettando la scheda! Per mezz'ora circa ho spinto il tasto di reset mentre caricavo il codice! I misteri dell'elettronica! Ho perso una giornata dietro questo problema ma alla fine tutto si è risolto! Spero possa essere d'aiuto a qualcuno! :wink:

saluti

Domenico

difatti era la prova che volevo farti fare... premere tasto reset durante la prima fase di caricamento :slight_smile:

Mimmo011:
Per mezz'ora circa ho spinto il tasto di reset mentre caricavo il codice! I misteri dell'elettronica!

beh se ci pensi è giusto che sia così... perchè il comando di sleep avviene nel loop... al momento che tu premi il reset, come prima cosa esegue il setup() dove non c'è la funzione sleep, e quindi riesci a caricare il codice :slight_smile:

basta solo beccare il momento giusto :slight_smile:

un saluto

MD