Skip to content

Instantly share code, notes, and snippets.

@jedp
Last active August 29, 2015 14:11
Show Gist options
  • Save jedp/56ed6bf206ef3a5cca42 to your computer and use it in GitHub Desktop.
Save jedp/56ed6bf206ef3a5cca42 to your computer and use it in GitHub Desktop.
Reporting low water level with the eTape
#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