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!
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);
}