const int humid = A5; const int dry=585; //value for dry conditions const int wet=298; //value for wet conditions void setup() { Serial.begin(9600); } void loop() { int sensorVal=analogRead(humid); int percHumidity=map(sensorVal, wet, dry, 100,0); //transform sensor range in a % soil humidity scale //careful: 298=100%, 585=0% Serial.print(percHumidity); Serial.println("%"); delay(1000); }