项目作者: kapraran

项目描述 :
A frequency counter library for esp32
高级语言: C++
项目地址: git://github.com/kapraran/FreqCountESP.git
创建时间: 2020-07-23T16:11:36Z
项目社区:https://github.com/kapraran/FreqCountESP

开源协议:MIT License

下载





FreqCountESP


FreqCountESP


A frequency counter library for esp32




Gitter

Table of Contents

" class="reference-link">About

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.

" class="reference-link">Installation

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.

" class="reference-link">Usage

Include the library in the sketch

  1. #include "FreqCountESP.h"

Initialize the instance

Set which pin to use and the length of the time frame in milliseconds.

  1. void setup()
  2. {
  3. int inputPin = 14;
  4. int timerMs = 1000;
  5. FreqCountESP.begin(inputPin, timerMs);
  6. }

Read the frequency

Wait for a new value to become available and read it by calling the read() method.

  1. void loop()
  2. {
  3. if (FreqCountESP.available())
  4. {
  5. uint32_t frequency = FreqCountESP.read();
  6. // Do something with the frequency...
  7. }
  8. }

" class="reference-link">Credits

" class="reference-link">License

MIT License

Copyright (c) 2020 Nikos Kapraras