I am having a little trouble with the looping of a variable being published. In short I am unable to adjust the time between publishing, either it doesn’t publish or it publishes ever hour.
I have tried delay, sleep and time now with set wait times.
Current firmware I am running is below;
int analogvalue = 0;
int boardLed = D7; // LED
int moister_value = 0;
char *message = "Kentia_P02";
void setup()
{
Particle.variable("Unit", message, STRING);
pinMode(boardLed,OUTPUT);
pinMode(A1, INPUT);
}
void loop()
{
digitalWrite(boardLed,HIGH);
analogvalue = analogRead(A1);
moister_value = (100 - ( (analogvalue/4095.00) * 100 ) ); // read capacitive sensor
Particle.variable("moister", &moister_value, INT);
delay(4000);
digitalWrite(boardLed,LOW);
// put device to sleep for 1 hours (3600 seconds)
//System.sleep(D1,RISING,3600);
//delay(360000);
}
I’d be grateful if someone can put me on the right track.