The input signal to CLKPin is 6667Hz6667 Hz.
#include <ESP8266WiFi.h>
const char* ssid = "SSID";
const char* password = "PASSWORD";
long nextPrint = 1000; // when to print the next message to serial
const int CLKPin = 5; // Pin connected to CLK
volatile long ClkCount = 0; // number of times clock interrupt has fired
void CLK_ISR() {
ClkCount++;
}
void setup() {
Serial.begin(115200);
long startTime = millis();
WiFi.begin(ssid, password); // Connect to the network
Serial.print("Connecting to ");
Serial.print(ssid); Serial.println(" ...");
while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
delay(500);
Serial.print(".");
}
Serial.println("\nConnected to wifi");
attachInterrupt(CLKPin, CLK_ISR, RISING);
//Set the CLK-pin to input
pinMode(CLKPin, INPUT);
}
void loop() {
if (millis() > nextPrint) {
Serial.print("Freq is: ");
Serial.println(ClkCount);
ClkCount = 0;
nextPrint += 1000;
}
yield();
}
#include <ESP8266WiFi.h>
const char* ssid = "SSID";
const char* password = "PASSWORD";
long nextPrint = 1000; // when to print the next message to serial
const int CLKPin = 5; // Pin connected to CLK
volatile long ClkCount = 0; // number of times clock interrupt has fired
void CLK_ISR() {
ClkCount++;
}
void setup() {
Serial.begin(115200);
long startTime = millis();
WiFi.begin(ssid, password); // Connect to the network
Serial.print("Connecting to ");
Serial.print(ssid); Serial.println(" ...");
while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
delay(500);
Serial.print(".");
}
Serial.println("\nConnected to wifi");
attachInterrupt(CLKPin, CLK_ISR, RISING);
//Set the CLK-pin to input
pinMode(CLKPin, INPUT);
}
void loop() {
if (millis() > nextPrint) {
Serial.print("Freq is: ");
Serial.println(ClkCount);
ClkCount = 0;
nextPrint += 1000;
}
yield();
}