Created
December 8, 2021 11:47
-
-
Save labsguru/fd7fff0a2fd3f3f1ef5da84b7b1c0e10 to your computer and use it in GitHub Desktop.
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
int FloatSensor = 2; | |
int led = 13; | |
int buttonState = 1; //reads pushbutton status | |
//https://kitsguru.myshopify.com/products/float-level-switch-water-level-sensor-for-water-level-controller | |
void setup() { | |
Serial.begin(9600); | |
pinMode(FloatSensor, INPUT_PULLUP); | |
pinMode (led, OUTPUT); | |
} | |
void loop() { | |
buttonState = digitalRead(FloatSensor); | |
if (buttonState == HIGH) { | |
digitalWrite(led, LOW); | |
Serial.println("WATER LEVEL - LOW"); | |
} | |
else { | |
digitalWrite(led, HIGH); | |
Serial.println("WATER LEVEL - HIGH"); | |
} | |
delay(1000); | |
} //Credits : https://pijaeducation.com/arduino/sensor/float-switch/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment