Last active
August 29, 2015 14:11
-
-
Save jedp/56ed6bf206ef3a5cca42 to your computer and use it in GitHub Desktop.
Reporting low water level with the eTape
This file contains 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
#define ETAPE A0 | |
// Set crucial level as appropriate for your needs. | |
// For me, 687 indicates three inches of water. | |
#define CRUCIAL_LEVEL 687 | |
#define LED_RED 13 | |
float resistance; | |
void setup(void) { | |
pinMode(LED_RED, OUTPUT); | |
Serial.begin(9600); | |
} | |
void loop(void) { | |
resistance = analogRead(ETAPE); | |
Serial.println(resistance); | |
if (resistance > CRUCIAL_LEVEL) { | |
digitalWrite(LED_RED, HIGH); | |
} else { | |
digitalWrite(LED_RED, LOW); | |
} | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment