Skip to content

Instantly share code, notes, and snippets.

@thomasdunn
Created December 12, 2015 07:42
Show Gist options
  • Save thomasdunn/ae7fba5b90eb31fd58af to your computer and use it in GitHub Desktop.
Save thomasdunn/ae7fba5b90eb31fd58af to your computer and use it in GitHub Desktop.
Particle Photon leak detector
String _version = "0.01";
#define FLOOD_NOTIF "FLOOD"
int LED = D7;
void setup() {
pinMode(LED, OUTPUT);
Spark.publish("device starting", "Firmware version: " + _version, 60, PRIVATE);
}
void loop() {
digitalWrite(LED,HIGH);
delay(10000);
digitalWrite(LED,LOW);
Spark.sleep(WKP, CHANGE);
while (true) {
//send an alarm to user (this one goes to the dashboard)
Spark.publish(FLOOD_NOTIF, "Flood detected!", 60, PRIVATE);
//send an alarm to user (this one goes to pushbullet servers)
Spark.publish("pushbullet", "Flood detected!", 60, PRIVATE);
delay(10000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment