Skip to content

Software debounce? #93

@michaeljanich

Description

@michaeljanich

I use
wpi.wiringPiISR(this.switchpin, wpi.INT_EDGE_RISING, this.toggle.bind(this));
to connect to a switch button and toggle a light.

But I get bounce. Usually I [Arduino] software-debounce with

if (digitalRead(pin)) {
     delay(25);
     if (digitalRead(pin)) {
         toggle();
     }
}

How is that best done on node? with wpi.delay(25)? or setTimeout(function() {}, 25);?

THANKS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions