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:
}
}
September 26, 2011 at 4:53 am
What company are you calling from? Kds Rape
zgwej
September 25, 2011 at 6:50 pm
I like it a lot Lolli Preteen Models Nn =-PPP
September 22, 2011 at 11:07 pm
Could I ask who’s calling? Top Young Bbs gwazlq
September 22, 2011 at 6:20 am
I enjoy travelling Pthc Download pbe
September 18, 2011 at 6:21 am
The manager bikini model bbs >:))
September 8, 2011 at 11:38 pm
Have you got a telephone directory? nn cuties
77661
September 7, 2011 at 7:16 am
I can’t get a signal preteen angels
wqbh
September 7, 2011 at 5:20 am
I hate shopping preteen pussy
nnw
September 9, 2010 at 1:57 am
Hello good day
August 4, 2010 at 4:39 am
lzd4z2 http://fgb7s3Ffjsev7yrbvqqcf7.com