GithubHelp home page GithubHelp logo

debouncedldr's Introduction

DebouncedLDR

This library implements a class that applies quantization and hysteresis to the analog readings of a Light Dependent Resistor (LDR) so that applications can work with logical light levels instead of physical light readings. Using this library, applications can easily avoid the flickering effects that can happen with simple thresholding.

Theory of operation

The DebouncedLDR class does not do any of the actual GPIO manipulation. The client application is expected to call DebouncedLDR::update frequently (i.e. every few milliseconds) with the latest reading from the analog pin. The update method returns the current logical light level.

The light level value returned by update represents a logical light level between zero and the maximum level passed to the instance's constructor. The noise parameter to the constructor is used to define "meaningful" changes in the LDR reading, a higher noise value requires a larger change in the readings to cause a change in the reported light level, and a noise value of zero will do no debouncing of the readings.

Testing

This library includes unit tests that can be run on a host system (not on the Arduino) using CMake. From the top-level of the library repo, these commands should run the tests:

cd tests
cmake -S . -B build
cmake --build build && (cd build; ctest --output-on-failure)

The first cmake command above only needs to be run once, the second command can be run each time the source is changed to check the test status.

debouncedldr's People

Contributors

zvonler avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.