Arduino Digital Pin Debounce And Digital Trigger

 

Debounce

Implemented digital pin debounce based on this . It puts in a 50 ms wait after a state change on a digital line.  Needs testing. 

It should help with encoders, bumpers, and other bouncy switches although remember boys & girls, you should always try to clean your signal at the source :)

Digital Trigger Only

When selected an polling a line an event is raised only when the state changes.  Encoders & bumpers would be better served using this selection. Typically this promote less chatty communication.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
DancesWithRobots's picture

Test Counter. . .

Here's a quick and dirty counter Greg did in Python to test the bumper switch debouncer.

bumperPin=5
arduino = Runtime.createAndStart("arduino","Arduino")
arduino.digitalReadPollingStart(bumperPin)

def input():
    print 'new pin data '
    print 'pin data is ',
    msg_arduino_publishPin.data[0]

GroG's picture

This is how it should

This is how it should look....

GroG's picture

Here's the latest - debounce

Here's the latest - debounce off and trigger on - with me moving a bouncy wire from 5v->gnd->5v-> etc...

GroG's picture

Woohoo - debounced &

Woohoo - debounced & triggered - dat'z the shiznit !