Giter Site home page Giter Site logo

Comments (4)

JChristensen avatar JChristensen commented on September 9, 2024 1

A very simple sketch that doesn't do much else can poll a switch in excess of 70kHz when running on a 16MHz AVR microcontroller like an Arduino Uno.

But at some point I assume there is other work to do, something needs to be done with the data, etc. So a better question may be how long does that take.

Depending on the expected frequency generated by the reed switch flow meter, and how long other processing takes, etc., I might opt for hardware debouncing and use the reed switch to drive an interrupt, especially if I were concerned about missing a switch closure.

Hope this helps.

from jc_button.

JChristensen avatar JChristensen commented on September 9, 2024 1

Maybe a better way to think about it is that by definition the maximum switch frequency is the reciprocal of the debounce time. So for example, if I have a 20mS debounce time, then the switch can't operate faster than 50Hz.

Then the question becomes, can whatever other processing that is needed occur in less than the debounce time. I'd probably want a significant safety factor there, so if I have a 20mS debounce time, then I'd want other processing to take no longer than maybe 10mS to be safe. If that's not possible, then I'd go with the hardware debounce/interrupt approach.

from jc_button.

mrarmyant avatar mrarmyant commented on September 9, 2024

I guess I was hoping this was on an interrupt pin but at the same time it might never get to send data out if that was the case.

from jc_button.

JChristensen avatar JChristensen commented on September 9, 2024

The library will work on any pin, it just polls the switch. I pretty much only intended it for HMI or similar situations. Specialized sensors probably deserve their own coding in many cases.

from jc_button.

Related Issues (20)

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.