arduino2/libraries/FreqCounter/Examples/FreqCounterLib_example/FreqCounterLib_example.ino
2020-11-06 13:17:55 +01:00

45 lines
825 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Frequency Counter Lib example
/*
Martin Nawrath KHM LAB3
Kunsthochschule f¸r Medien Kˆln
Academy of Media Arts
http://www.khm.de
http://interface.khm.de/index.php/labor/experimente/
*/
#include <FreqCounter.h>
unsigned long frq;
int cnt;
int pinLed=13;
void setup() {
pinMode(pinLed, OUTPUT);
Serial.begin(115200); // connect to the serial port
Serial.println("Frequency Counter");
}
void loop() {
// wait if any serial is going on
FreqCounter::f_comp=10; // Cal Value / Calibrate with professional Freq Counter
FreqCounter::start(100); // 100 ms Gate Time
while (FreqCounter::f_ready == 0)
frq=FreqCounter::f_freq;
Serial.print(cnt++);
Serial.print(" Freq: ");
Serial.println(frq);
delay(20);
digitalWrite(pinLed,!digitalRead(pinLed)); // blink Led
}