14. Arduino Liquid Water Level Sensor with Horizontal Float Switch 2

14. Arduino Liquid Water Level Sensor with Horizontal Float Switch



How to make Arduino Liquid Water Level Sensor using Horizontal Float Switch with code .

// IMPORTANT replace all brackets to left or right brackets to get code to work

#define Water_Level_Sensor 2

int buttonState = 1; // variable for reading the pushbutton status

void setup() {

Serial.begin(9600);
pinMode(Water_Level_Sensor, INPUT);

}

void loop() {

buttonState = digitalRead(Water_Level_Sensor);

if (buttonState == HIGH) {
Serial.println( “WATER LEVEL – LOW”);
}
else {
Serial.println( “WATER LEVEL – HIGH” );
}

delay(300);

}

source

Leave a Comment

Your email address will not be published. Required fields are marked *

×

Hello!

Click one of our representatives below to chat on WhatsApp or send us an email to [email protected]

 

× Order Via Whatsapp?