Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

Debounce example doesn't work properly.

$
0
0
Description:
Debounce example checks the state of PUSH2 on G2 LaunchPads and toggles the green LED based on the button being pushed using 'time' filtering to eliminate extraneous button pushes or noise. As delivered, the example does nothing to the green LED regardless of the button being pushed or not.

Changing:
void setup() {
  pinMode(buttonPin, INPUT);
  pinMode(ledPin, OUTPUT);
}
... to ...
void setup() {
  pinMode(buttonPin, INPUT_PULLUP); // <--- note the change to "INPUT_PULLUP"
  pinMode(ledPin, OUTPUT);
}
... corrects the issue: the green LED is on unless the button is pushed.

Issue opened: here.

This post was made so as to inform users trying to implement software debouncing in accordance with the example.

Viewing all articles
Browse latest Browse all 2077

Trending Articles