determination duration of a period

hello i need to determination duration of a period for my project. some one help me . thanks

With what little you've told us, I'd say you should look at the millis() function.... http://www.arduino.cc/en/Reference/Millis

pulseIn? micros? millis?

A period can mean so many things. The easiest for me to answer is if you mean a period between two rising pulses attached to a digital input pin. Here is an example of how to use an interrupt pin to measure the length of a pulse, which can be used to calculate the period of a stream of pulses:

``````// connect a button between pin 3 and ground to simulate pulses
#define pulsedPin 3 // INT1 on most Arduino boards
volatile byte pulsedPinState;
int lastPulsedPinState = 0;
unsigned long prevEdgeMillis;

// interrupt service routine
}

void setup() {
pinMode(pulsedPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(pulsedPin), readPulseLevel, CHANGE); // interrupt on edge
Serial.begin(9600);
}

void loop()
{
if (pulsedPinState != lastPulsedPinState) {
unsigned long edgeMillis = millis();  // save current time
if (pulsedPinState != 0) {            // rising edge
prevEdgeMillis = edgeMillis;        // remember this time as the leading edge of the pulse'
} else {                                                    // falling edge
unsigned long pulseLength = edgeMillis - prevEdgeMillis;  // calculate pulse length millis
Serial.print(pulseLength);Serial.println(" milliseconds");
}
lastPulsedPinState = pulsedPinState;
}
}
``````

If you are measuring something other than a square wave, things will be more complicated - hardware and software-wise. Look into a circuit called a schmitt trigger. Properly configured, it can convert an unruly signal into a square wave. If your application concerns a wife or girlfriend, there are apps for that.