Metropolitan water theft using WSN
Code for arduino in C
void setup() {
Serial.begin(9600);
pinMode(9, OUTPUT);
pinMode(10, INPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(9, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000);
int sensorValue = analogRead(A0);
int sensorValue1 = digitalRead(10);
if(sensorValue>680)
{
Serial.println("1");
}
if(sensorValue1==HIGH)
{
Serial.println("2");
}
if (Serial.available() > 0) {
digitalWrite(9, LOW); // turn the LED on (HIGH is the voltage level)
delay(1000);
digitalWrite(9, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000);
digitalWrite(9, LOW); // turn the LED off by making the voltage LOW
delay(10000); // wait for a second
}
}
Serial.begin(9600);
pinMode(9, OUTPUT);
pinMode(10, INPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(9, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000);
int sensorValue = analogRead(A0);
int sensorValue1 = digitalRead(10);
if(sensorValue>680)
{
Serial.println("1");
}
if(sensorValue1==HIGH)
{
Serial.println("2");
}
if (Serial.available() > 0) {
digitalWrite(9, LOW); // turn the LED on (HIGH is the voltage level)
delay(1000);
digitalWrite(9, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000);
digitalWrite(9, LOW); // turn the LED off by making the voltage LOW
delay(10000); // wait for a second
}
}
![](http://www.weebly.com/weebly/images/file_icons/gz.png)
1540.zip | |
File Size: | 1432 kb |
File Type: | zip |
![](http://www.weebly.com/weebly/images/file_icons/image.png)
block_diagram.jpg | |
File Size: | 148 kb |
File Type: | jpg |