Go to Post What is this "tired" of which you speak? Did it come in the KOP? - EricH [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Spotlight this post!  
Unread 30-01-2013, 12:48
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,561
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: LimitSwitch as Command Button

Quote:
Originally Posted by notmattlythgoe View Post
My only worry is getting multiple triggers with one press from noise on the channel. We're trying to implement a frisbee counter that count frisbees coming in and leaving the robot. We tried using the Counter class, but we kept getting random increases in the count from the limit switches. I'm assuming there was noise as the switch was pressed which made it think that there were multiple presses.
The counter class acts as an interrupt and counts every single edge of the switch bounce, which isn't what you want.

The simplest method for dealing with switch bounce is to poll the switch slower then the duration of the switch bounce. This works as long as the process actuating the switch is "slow", which my guess is that a frisbee counter is. For example, if the switch bounces for 10ms, polling it every 20ms will give you at worst one reading during switch bounce. If you happen to sample low during the bounce, you're reading of the switch will be delayed 20ms (the next sample will be high). If you happen to sample high during the switch bounce, you will react immediately (and the next sample will be high). If you extend button to read the switch, it would automatically get called at 20ms.

The following paper has lots of examples of switch bounce, as well as examples of both hardware and software debouncing, if you determine you do need to debounce. http://www.eng.utah.edu/~cs5780/debouncing.pdf

If you extend Button, you could implement your debouncing algorithm in get method.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:04.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi