• There is big chances the moisture sensor is analog, like the one from Adafruit (https://www.sparkfun.com/products/13322).

    Then, the code is quite easy:
    Just use the analogRead(PIN) function with the correct pin name and there it is. Then you can add some threshold or whatever you want depending on your application

About