Hi,
We wrote a small example program for PIC
[code]void main()
{
PORTC=0; //initialize portc
TRISC=0x07; //configure portc (RC7 to RC3) as output and (RC2 to RC0 as input)
ANSELH=0; //configure an pin as digital I/O
ANSEL=0;
while(1){
//connect the grove water sensor sig to PIN RC0,RC1 and RC2( you need a 3 grove water sensor)
//connect the green led to PIN RC3,yellow led to PIN RC4,red lec to RC5 and Buzzer to RC6
if((RC0==1)&&(RC1==1)&&(RC2==1)){
//All Leds and Buuzzer off states
PORTC=0x00;
}
if((RC0==0)&&(RC1==1)&&(RC2==1))
{
//This states LED green blinking
PORTC=0x04;
delay(200);
PORTC=0x00;
delay(200);
}
if((RC0==0)&&(RC1==0)&&(RC2==1))
{
//This states LED yellow blinking
PORTC=0x08;
delay(200);
PORTC=0x00;
delay(200);
}
if((RC0==0)&&(RC1==0)&&(RC2==0))
{
//This states LED red blinking and buzzer on
PORTC=0x60;
delay(200);
PORTC=0x40;
delay(200);
}
}[/code]
Let us know if it helps you.
Thanks and Regards