Skip to content

Instantly share code, notes, and snippets.

@mikebranstein
Created September 19, 2017 15:07
Show Gist options
  • Save mikebranstein/239a5a2d318e569df43ce55ff9e12e65 to your computer and use it in GitHub Desktop.
Save mikebranstein/239a5a2d318e569df43ce55ff9e12e65 to your computer and use it in GitHub Desktop.
Main weather monitor app
#include "weather-service.h"
#define MINUTES_TO_SLEEP (15*60)
WeatherService weatherService;
// setup() runs once, when the device is first turned on.
void setup() {
// initialize the weather service, true = debug, false = production
weatherService.init(false);
}
// loop() runs over and over again, as quickly as it can execute.
void loop() {
char* json = weatherService.getWeatherData();
Particle.publish("w", json, PRIVATE);
System.sleep(weatherService.getRainGaugeSignalPin(), FALLING, MINUTES_TO_SLEEP);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment