View Single Post
  #21   Spotlight this post!  
Unread 06-03-2013, 09:01
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,758
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: Sensor "de-noising"

Quote:
Originally Posted by Ether View Post

Here's a simple IIR filter which does essentially the same thing with 2 lines of code, no loops, and no conditional logic:

Code:
ave = 0.5*(input+ave);
output = truncate(ave+0.03);
It does use floating point (for ave), but the cRIO has an FPU.

input and output are 0 or 1.
It's been a while since I've done IIR filters and such, so my math on them is rusty. Is that actually exactly equivalent to checking than the signal has been 1 for the last X ms? It would seem that it would tolerate some blips low. And it definitely switches 1->0 quicker than 0->1.

Mind you, it's probably a perfectly cromulent and simple solution to the OP's actual problem, it just seems different than actual debouncing.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter