@kdomkus, your topic has been moved to a more suitable location on the forum.
Please read How to get the best out of this forum and pay special attention how to post code using code tags; people using cellphones in general can't view ino attachments so by posting in the post instead of attaching more people might be able to help.
Below your code from the opening post
const int CLK = 2; // D2
volatile long fcnt = 0; // to keep track of clk pulses
long lastcnt;
//Interrupt routines --
/*********************************************************************/
void onCLK()
/*********************************************************************/
{
fcnt++;
}
/*********************************************************************/
/*********************************************************************/
void setup()
/*********************************************************************/
{
Serial.begin(115200);
while (!Serial);
pinMode(CLK, INPUT);
attachInterrupt(digitalPinToInterrupt(CLK), onCLK, RISING);
}
/*********************************************************************/
void loop()
{
while(1)
{
Serial.println("Fcnt: " + String(fcnt) + " Delta Cnt: " + String(fcnt-lastcnt));
lastcnt = fcnt;
delay(1000);
}
}