oddson
Well-known member
Simple code... returns 'fail'...
Tried to add a debounced button to an existing MIDI sketch and it didn't work.
Stripped everything out of the sketch leaving just this:
Prints 'fail' every time.
I know I'll be embarrassed... anyone know what I'm missing?
edit - compiling as 'Serial' but the problem appeared with (usb)MIDI selected.
Tried to add a debounced button to an existing MIDI sketch and it didn't work.
Stripped everything out of the sketch leaving just this:
Code:
#include <Bounce.h>
Bounce button0 = Bounce(0,10);
void setup() {
Serial.begin(9600);
}
void loop() {
if (button0.update()) {
if (button0.fallingEdge()) {
Serial.println("fall");
}
if (button0.risingEdge()) {
Serial.println("rise");
}
}else{
Serial.println("fail");
delay(2000);
}
}
I know I'll be embarrassed... anyone know what I'm missing?
edit - compiling as 'Serial' but the problem appeared with (usb)MIDI selected.
Last edited: