https://github.com/tfeldmann/arduino-schmitttrigger
A lightweight schmitt trigger for debouncing and filtering.
https://github.com/tfeldmann/arduino-schmitttrigger
arduino-library platformio-library schmitt-trigger
Last synced: 12 months ago
JSON representation
A lightweight schmitt trigger for debouncing and filtering.
- Host: GitHub
- URL: https://github.com/tfeldmann/arduino-schmitttrigger
- Owner: tfeldmann
- License: mit
- Created: 2020-05-27T12:52:46.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-01T11:24:54.000Z (almost 3 years ago)
- Last Synced: 2025-04-14T18:50:34.559Z (over 1 year ago)
- Topics: arduino-library, platformio-library, schmitt-trigger
- Language: C++
- Homepage:
- Size: 23.4 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Arduino-SchmittTrigger
[![tests][gh-tests-badge]][gh-tests-link]
## Installation
```
pio lib install "tfeldmann/SchmittTrigger"
```
## Example usage:
Assumes you have a potentiometer connected to A0 and a led connected to `PIN_LED`.
- This will turn `PIN_LED` on potentiometer readings higher than `900`.
- On readings lower than `800` `PIN_LED` will be pulled `LOW`.
- On readings between `800` and `900` the LED state persists.
```cpp
#include
// 800 is the switch off point
// 900 is the switch on point
SchmittTrigger trigger(800, 900);
void setup()
{
pinMode(PIN_LED, OUTPUT);
}
void loop()
{
trigger.input(analogRead(A0));
digitalWrite(PIN_LED, trigger.output());
}
```
[gh-tests-badge]: https://github.com/tfeldmann/Arduino-SchmittTrigger/actions/workflows/tests.yml/badge.svg
[gh-tests-link]: https://github.com/tfeldmann/Arduino-SchmittTrigger/actions/workflows/tests.yml