Start by figuring out what value/value change of A1 constitutes a pulse.
When you read a pulse, record the time (Use millis()).
When you read the next pulse, note the time and subtract it from the previous time you recorded to get the difference. Look at the Smoothing example for the logic on doing a running average.