When I send a message, the device responds with 'Transmission KO'. Transmission went fine for 2 days, but this afternoon I wasn't able to send any message anymore.
My communication status on the Sigfox portal is red. (my token state is OK)
When sending a message, I get a KO (result = 0) as a result of the SigFox.endPacket command.
During transmission the LED blinks very long (sigfox.debug is active)
Any advice?
This is my code:
/*
SigFox send message.
*/
#include <SigFox.h>
#include <ArduinoLowPower.h>
String TextToSend = "VNP0018BC8E1";
unsigned long timeBetweenMessages = 20 * 60 * 1000; //wait x (first number) minutes
bool debugViaLed = false;
bool debugViaLedSend = true;
bool debugViaLedSetup = true;
bool sigfoxDebug = true;//false;
void setup() {
//On MKRFOX1200 the onboard LED is connected to D6
pinMode(6, OUTPUT);
// Start the module
SigFox.begin();
// Wait at least 30mS after first configuration (100mS before)
delay(100);
if (sigfoxDebug) SigFox.debug();
// Clears all pending interrupts
SigFox.status();
delay(100);
// Shut down module, back to standby
SigFox.end();
// Blink when setup is ready
if (debugViaLedSetup) blinking(100,2);
}
/* Main loop */
void loop()
{
if (debugViaLed) blinking(3000,1);
sigfoxSend(TextToSend);
LowPower.sleep(timeBetweenMessages);
if (debugViaLed) blinking(300,7);
}
/* Funtion to send messages over Sigfox */
void sigfoxSend(String str) {
if (debugViaLed) blinking(300,2);
// Start the module
SigFox.begin();
// Wait at least 30mS after first configuration (100mS before)
delay(1000);
// Clears all pending interrupts
SigFox.status();
delay(1000);
if (debugViaLedSend or debugViaLed) blinking(300,3);
SigFox.beginPacket();
if (debugViaLed) blinking(300,4);
SigFox.print(str);
if (debugViaLed) blinking(300,5);
int result = SigFox.endPacket(true);
if (debugViaLedSend or debugViaLed) {
if (result == 1) {
blinking(8000,1);
} else {
blinking(3000,1);
}
}
// shut down module, back to standby
SigFox.end();
}
/* Funtion to use the onboard LED for debug /
/ Parameters: - upTime: number of ms the LED is up /
/ - xTimes: number of blinks */
void blinking(unsigned long upTime,int xTimes) {
delay(3000);
for (int x = 0; x<xTimes; x++) {
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(upTime); // wait for [upTime] ms
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(upTime); // wait for [upTime] ms
}
}