How to read a square wave using arduino

I am making a capactive soil moisture sensor using an ic555 circuit ,i am getting a square wave as an output ,how should i read this square wave in the form of voltage using arduino. Pls suggest me an method or a code which does so

By feeding it into an analog pin, then measuring the value you get...

Providing the 555 gives a voltage out less than 5v or use a voltage divider.

Measure the frequency?

What kind of square ware how does it change with the soil moisture?

Mark

Maybe see:
https://ccrma.stanford.edu/~fgeorg/250a/lab2/arduino-0019/reference/PulseIn.html

it works on the principle of dielectric whenever water is introduced in the soil the frequency changes so i wanted to convert this frequency into voltage so i can easily read it on the arduino

randolphpereira:
it works on the principle of dielectric whenever water is introduced in the soil the frequency changes so i wanted to convert this frequency into voltage so i can easily read it on the arduino

Converting it to voltage will make it more difficult to read on the Arduino, or at least it will make it less accurate. If you want to check frequenct of a square wave, time the cycles to get the period, the divide the period into 1.

You could use micros() or millis() and test for two rising pulses (or two falling pulses).
You could use pulseIn() to check the durationof HIGH plus LOW.