You can use an interrupt triggered when the pin goes from low to high (voltage) and then, measure time.
unsigned long lastTime;
unsigned long Period;
void setup()
{
attachInterrupt(0, measureFrec, RISING); // Arduino Pin 2
}
void measureFrec()
{
unsigned long time;
time = millis(); // Beware overflow!!
Period = time - lastTime;
lastTime = time;
}