1) Objective:
Detect the amount of water around the the water level sensor
2)Parts:
Basic board x 1;
Water level Sensor x 1;
USB cable x 1;
3)Connection circuit:
Water Sensor | Basic board |
– | GND |
+ | 5V |
S | A0 |
4)Download code and load it into Basic board.
5)Open up the serial window by clicking on the Serial monitor located at the upper right hand corner of the IDE.
6)Once the sensor detects water, the LED will turn on and the serial monitor will show water values as shown in the following images
DownLoad Url osoyoo.com
You must be logged in to post a comment.
TEST OK.
>>HARDWARE :
Osoyoo UNO Board (Fully compatible with Arduino UNO rev.3) x 1
Breadboard x 1
Water level Sensor x 1
M/M jumpers
USB Cable x 1
PC x 1
>>Pin Definitions :
+ : 3.3V-5V ⇔ UNO 5V
- : The Ground ⇔ UNO GND
S : I/O Interface of Sensor ⇔ UNO PIN A0
>>Mixly source :
volatile int val;
void setup()
{
Serial.begin(9600);
val = 0;
pinMode(13, OUTPUT);
}
void loop()
{
val = analogRead(A0);
if (val > 200) {
digitalWrite(13,HIGH);
} else {
digitalWrite(13,LOW);
}
Serial.print(“Current value is : “);
Serial.print(val);
Serial.println(” “);
delay(100);
}