Hello I did some tests to use the sleeping commands, I can't understand why,
if I activate the sleeping method (hibernate or stop) it doesn't publish on the console.
Code:
// Include Particle Device OS APIs
#include "Particle.h"
int ledPin = D7;
// Let Device OS manage the connection to the Particle Cloud
SYSTEM_MODE(AUTOMATIC);
int PressV=30;
void setup()
{
Serial.begin(9600);
pinMode(ledPin, OUTPUT); // sets the pin as output
Particle.variable("PressV",PressV);
}
void loop(){
Particle.publish("PressV",PressV);
digitalWrite(ledPin,HIGH);
delay(5000);
digitalWrite(ledPin,LOW);
delay(1000);
/*SystemSleepConfiguration config;
config.mode(SystemSleepMode::HIBERNATE)
.gpio(D2, RISING);
System.sleep(config);*/
/*SystemSleepConfiguration config;
config.mode(SystemSleepMode::STOP)
.gpio(D2, FALLING)
.duration(30000);
System.sleep(config);*/
}
[/quote]
Thanks for the suggestions, I have done the changes but nothing is published to the console using the SystemSleepConfiguration, doing a rem to these steps works. For your info I have an Argon the firmware version is 6.2.1.
Yes it will be published if I remove the suspension, unfortunately I can't do anything for a week, I'll start working on it again when I get back. Thanks
Oh, think I see what's wrong. If you are using Device OS 6.2.0 or later, or SYSTEM_THREAD(ENABLED), at least the first publish occurs before you've connected to the cloud so it fails, then you go to sleep. Try inserting before the Particle.publish call in loop():