Hey, im a total newbee to programing I am making a moisture sensor but i have problems with the code
I dont know what the problem is, but it doesnt' seem tor work. Can anyone help me?
int msensor = Al; //moisture sencor is connected with the analog in Al of the Arduino
int msvalue =0; //moisture sencor value
int led = 13;
boolean flag = false;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(msensor, INPUT);
pinMode(led, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
msvalue = analogRead(msensor);
Serial.println(msvalue);
if ( (msvalue >=500 ) && ( flag == false ) )
{
digitalWrite(led, HIGH);
flag = true;
delay(1000);
}
if ( (msvalue<=300) && (flag == true) )
}
digitalWrite(led,LOW);
flag = false;
delay(1000);
}