// library’s used
#include <rain.h>
/*-----( Declare Constants and Pin Numbers )-----*/
int RainSensor = A0;
/*-----( Declare objects )-----*/
/*-----( Declare Variables )-----*/
int thresholdValue = 500; // you can adjust the threshold value
void setup()/****** SETUP: RUNS ONCE ******/
{
pinMode(RainSensor, INPUT);
Serial.begin(9600);
Serial.println("Rain Sensor Test");
}
void loop() /****** LOOP: RUNS CONSTANTLY ******/
{
// read the input on analog pin 0:
int sensorValue = analogRead(RainSensor);
if(sensorValue < thresholdValue){
Serial.println("Rain Detected");
}
else {
Serial.println("No Rain Detected");
}
delay(500);
}