Created
December 12, 2015 07:42
-
-
Save thomasdunn/ae7fba5b90eb31fd58af to your computer and use it in GitHub Desktop.
Particle Photon leak detector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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