Water Level Indicator

This project is water level indicator.This is real time application in which we can use in our day to day life.

/*
Analog Input
Demonstrates analog input by reading an analog sensor on analog pin 0 and
turning on and off a light emitting diode(LED)  connected to digital pin 13.
The amount of time the LED will be on and off depends on
the value obtained by analogRead().

The circuit:
* Potentiometer attached to analog input 0
* center pin of the potentiometer to the analog pin
* one side pin (either one) to ground
* the other side pin to +5V
* LED anode (long leg) attached to digital output 13
* LED cathode (short leg) attached to ground

* Note: because most Arduinos have a built-in LED attached
to pin 13 on the board, the LED is optional.

Created by David Cuartielles
Modified 16 Jun 2009
By Tom Igoe

http://arduino.cc/en/Tutorial/AnalogInput

*/

int sensorPin0 = 0;    // select the input pin for the potentiometer
int sensorPin1 = 1;
int sensorPin2 = 2;
int sensorPin3 = 3;
int sensorPin4 = 4;
int sensorPin5 = 5;
int ledPin0 = 2;      // select the pin for the LED
int ledPin1 = 3;
int ledPin2 = 4;
int ledPin3 = 5;
int ledPin4 = 6;
int ledPin5 = 7;
int ledPin6 = 8;
int ledPin7 = 9;
int sensorValue0;  // variable to store the value coming from the sensor
int sensorValue1;
int sensorValue2;
int sensorValue3;
int sensorValue4;
int sensorValue5;
void setup() {
// declare the ledPin as an OUTPUT:
Serial.begin(9600);
pinMode(ledPin0, OUTPUT);
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
pinMode(ledPin4, OUTPUT);
pinMode(ledPin5, OUTPUT);
pinMode(ledPin6, OUTPUT);
pinMode(ledPin7, OUTPUT);
}

void loop() {
// read the value from the sensor:
sensorValue0 = analogRead(sensorPin0);
Serial.print(“a”);
Serial.println(sensorValue0);
if(sensorValue0<300)
// turn the ledPin on
{
digitalWrite(ledPin0, HIGH);
// stop the program for <sensorValue> milliseconds:
}
else
{
digitalWrite(ledPin0, LOW);
digitalWrite(ledPin6,HIGH);
digitalWrite(ledPin7,HIGH);
// turn the ledPin off:

// stop the program for for <sensorValue> milliseconds:
}

sensorValue1 = analogRead(sensorPin1);
Serial.print(“b”);
Serial.println(sensorValue1);
if(sensorValue1<450)

{// turn the ledPin on
digitalWrite(ledPin1, HIGH);
// stop the program for <sensorValue> milliseconds:
}
else
{
// turn the ledPin off:
digitalWrite(ledPin1, LOW);
// stop the program for for <sensorValue> milliseconds:
}

sensorValue2 = analogRead(sensorPin2);
Serial.print(“c”);
Serial.println(sensorValue2);
//delay(1000);
if(sensorValue2<400)
{
// turn the ledPin on
digitalWrite(ledPin2, HIGH);
// stop the program for <sensorValue> milliseconds:
}
else
{
// turn the ledPin off:
digitalWrite(ledPin2, LOW);
// stop the program for for <sensorValue> milliseconds:
}

sensorValue3 = analogRead(sensorPin3);
Serial.print(“d”);
Serial.println(sensorValue3);
//delay(1000);
if(sensorValue3<250)
{
// turn the ledPin on
digitalWrite(ledPin3, HIGH);
// stop the program for <sensorValue> milliseconds:
}
else
{
// turn the ledPin off:
digitalWrite(ledPin3, LOW);
// stop the program for for <sensorValue> milliseconds:
}

sensorValue4 = analogRead(sensorPin4);
Serial.print(“e”);
Serial.println(sensorValue4);
//delay(1000);
if(sensorValue4<250)
{
// turn the ledPin on
digitalWrite(ledPin4, HIGH);
// stop the program for <sensorValue> milliseconds:
}
else
{
// turn the ledPin off:
digitalWrite(ledPin4, LOW);
// stop the program for for <sensorValue> milliseconds:
}

sensorValue5 = analogRead(sensorPin5);
Serial.print(“f”);
Serial.println(sensorValue5);
//delay(1000);
if(sensorValue5<200)
{
// turn the ledPin on
digitalWrite(ledPin5, HIGH);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, LOW);
// stop the program for <sensorValue> milliseconds:
}
else
{
// turn the ledPin off:
digitalWrite(ledPin5, LOW);
// stop the program for for <sensorValue> milliseconds:
}
}

Advertisement

10 Responses to “Water Level Indicator”

  1. What company are you calling from? Kds Rape
    zgwej

  2. Could I ask who’s calling? Top Young Bbs gwazlq

  3. Have you got a telephone directory? nn cuties
    77661

  4. I can’t get a signal preteen angels
    wqbh

  5. Hello good day

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.