Hello does anyone know which Bounce example is best to use to make a pushbutton act like a toggle switch? I am using a teensy 2.0++ for XPlane 11.
Hello does anyone know which Bounce example is best to use to make a pushbutton act like a toggle switch? I am using a teensy 2.0++ for XPlane 11.
You need more than just the Bounce library. You will also need to add some code to remember the emulated toggle switch's position.
Something like this...
Code:button1.update(); if (button1.fallingEdge()) { if (toggleState == true) { toggleState = false; Serial.println("Toggle switch is off"); } else { toggleState = true; Serial.println("Toggle switch is on"); } }
Thanks I'll try that.