Read a freqency from an analog pin

Thanks for answers. :slight_smile:

I write the code below:

#include <FreqCounter.h>

double frequency;


void setup() {
  pinMode(5,OUTPUT);
  pinMode(11,OUTPUT);
  pinMode(12,OUTPUT);
  pinMode(15,OUTPUT);
  pinMode(16,OUTPUT);
  pinMode(17,OUTPUT);

}



void loop() {
  
long getFrequency(A0); { 
#define SAMPLES 4096 
long freq = 0; 
for(unsigned int j=0; j<SAMPLES; j++) freq+= 500000/pulseIn(A0, HIGH, 250000); 
frequency = freq/SAMPLES;
if (frequency <1) { digitalWrite(5, HIGH);
                   digitalWrite(11,HIGH);}
if (frequency >=1) { digitalWrite(12, HIGH);
                   digitalWrite(15,HIGH);}
                   
}


  
}

No errors, but circuit doesen't work. I have mistakes in the code?