int _moisture,sensor_analog;
const int sensor_pin = 34; /* Chan O/P cua cam bien do am dat */
void setup(void){
Serial.begin(115200); /* Thiet lap baudrate thanh 115200*/
}
void loop(void){
sensor_analog = analogRead(sensor_pin);
_moisture = ( 100 - ( (sensor_analog/4095.00) * 100 ) );
Serial.print("Moisture = ");
Serial.print(_moisture); /* In gia tri ra cong Serial */
Serial.println("%");
delay(1000); /* Doi 1000mS */
}