January 22, 2005

I don't buy that debouncing code for a second. 

HHhmmm.... to trust the anonymous website or the known experienced coder. I think I'll go with the experienced coder on this one. Interested in trying to build one? Maybe PoblanoMacaroni would like to jump in, too? 

Just to be clear: I bet the whole thing works for the most part -- but the author admits the device is occasionally flaky, and I am highly suspicious of the debouncing strategy (which is simply to poll every 10ms). I don't see how that keeps you from sampling during a bounce. Also to note -- the device is an old-school analog cell phone, not a modern digital SprintPCS/Cingular/TMobile/Whatevs. 

While it is not that fancy, I don't think the debouncing strategy is necessarily as bad as you think. The way the while loops are structured, the 10 ms delay is synchronized to the change in logic state, so it's not as if there is a 100 Hz polling routine that may or may not hit in the middle of a bounce. However, the real question is how he came up with 10 ms. You obviously have to choose a time here that is longer than the bouncing time but short enough that you don't miss a '1' or '0' entirely. A little characterization of the bouncing with an o'scope goes a long way here. 

« Older If they mated . . . | Animal cruelty by splatnikGanglion Newer »



To post comments to a thread you must login or create a profile.