Looking for guidance in frequency measurement

Well good news, my meter and serial out are saying the same thing. Thank you @DaveX . In case someone comes upon this in a search, the below code will output a frequency of 20hz, from pin 8 to pin 49. You'll need to install FreqMeasure by Paul Stoffregen in your sketch library as well.


#include <FreqMeasure.h>


double sum=0;
int count=0;

void setup()
{
    Serial.begin(9600);
    FreqMeasure.begin();
    while (!Serial)
    {
      ; // Wait for serial to connect
    }
    Serial.println("");
    delay(2000);
   
    Serial.println("Frequency Demo");

    pinMode(8, OUTPUT);
}

void loop()
{

    digitalWrite(8, HIGH);
    delay(25);
    digitalWrite(8, LOW);
    delay(25);

    if (FreqMeasure.available()) 
    {
        // average several reading together        
        sum = sum + FreqMeasure.read();
        count = count + 1;
        if (count > 30) 
        {
            float frequency = FreqMeasure.countToFrequency(sum / count);
            Serial.println(frequency);
            sum = 0;
            count = 0;
        }
    }
}