Comments (4)
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.
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.
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.
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)
- does not work with i2c HOT 3
- ESP 8266 HOT 3
- Very minor - extra example req HOT 1
- Simulate physical button press? HOT 1
- Continuous integration / unit tests HOT 1
- library.properties says architecture is AVR only HOT 7
- UpDown.ino: Non-working usage of min()/max()... HOT 1
- Not working with Nano Every HOT 36
- no syntax highlighting when library is included HOT 7
- Detect Simultaneous Events HOT 8
- Explicit set to togglebutton HOT 3
- Setup Inputs breaks the code HOT 1
- Can a button be toggle and long press at the same time? HOT 1
- Not immune to noise :( HOT 2
- double_click check HOT 4
- Just a Thank-you and a fork HOT 1
- Compilation warning when working with Arduino Rev4 HOT 2
- WARNING: library JC_Button claims to run on avr architecture(s) and may be incompatible with your current board which runs on STM32F1 architecture(s). HOT 1
- Feature request: Compatibility for Arduino Every HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jc_button.