Home ArduinoArduino Code Arduino and water sensor example

Arduino and water sensor example

This is a water sensor that I obtained as part of a kit recently, its fairly easy to connect this to your Arduino. the requirements are simply VCC (5v), GND and then connect the SIG to one of the Analog pins. In our code example this will be Analog 0.

eb water sensor

eb water sensor

 

Code

int analogPin = 0;
int led = 13;
int val = 0;

void setup()
{
pinMode (led, OUTPUT);
Serial.begin (9600);
}

void loop()
{
val = analogRead(analogPin);
if (val > 600)
{
digitalWrite(led, HIGH);
}
else
{
digitalWrite(led, LOW);
}
Serial.println(val);
delay (100);
}

 

Links

 

arduino water sensor at Amazon Uk

arduino water sensor at Amazon US

You may also like