https://github.com/kapraran/FreqCountESP
A frequency counter library for esp32
https://github.com/kapraran/FreqCountESP
arduino esp32 esp32-library frequency-counter interrupt-driven-programs
Last synced: 10 days ago
JSON representation
A frequency counter library for esp32
- Host: GitHub
- URL: https://github.com/kapraran/FreqCountESP
- Owner: kapraran
- License: mit
- Created: 2020-07-23T16:11:36.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-20T11:54:35.000Z (10 months ago)
- Last Synced: 2025-06-11T08:01:22.690Z (11 days ago)
- Topics: arduino, esp32, esp32-library, frequency-counter, interrupt-driven-programs
- Language: C++
- Homepage: https://kapraran.github.io/FreqCountESP/
- Size: 32.2 KB
- Stars: 41
- Watchers: 1
- Forks: 8
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
FreqCountESP
A frequency counter library for esp32
### Table of Contents
- [About](#about)
- [Installation](#installation)
- [Usage](#usage)
- [Credits](#credits)
- [License](#license)A frequency counter library for esp32. It counts the numbers of pulses on a specified pin during a fixed time frame using native interrupts and timers. It only supports one instance per sketch for now.
To use this library you have to import it into Arduino IDE as follows:
1. Download or clone this repository as a zip file.
2. Go to "Sketch" > "Include Library" > "Add .ZIP library..." and select the zip file to import it.#### Include the library in the sketch
```C++
#include "FreqCountESP.h"
```#### Initialize the instance
Set which pin to use and the length of the time frame in milliseconds.
```C++
void setup()
{
int inputPin = 14;
int timerMs = 1000;
FreqCountESP.begin(inputPin, timerMs);
}
```#### Read the frequency
Wait for a new value to become available and read it by calling the `read()` method.
```C++
void loop()
{
if (FreqCountESP.available())
{
uint32_t frequency = FreqCountESP.read();
// Do something with the frequency...
}
}
```* Big thanks to [@dpwe](https://github.com/dpwe) for his contributions https://github.com/kapraran/FreqCountESP/pull/5
* [FreqCount library for Arduino & Teensy boards](https://www.pjrc.com/teensy/td_libs_FreqCount.html)
* [Frequency Icon](https://www.flaticon.com/free-icon/pulse_597841?term=frequency&page=1&position=2)[MIT License](https://github.com/kapraran/FreqCountESP/blob/master/LICENSE)
Copyright (c) 2020 [Nikos Kapraras](https://kapraran.dev)