Best Answer Mario Vernari , 20 March 2015 - 04:53 AM
I just tried for you...
In theory, your circuit should work, but the problem is that the Netduino does not offer a "pull down" feature.
Simply invert the logic, and wire the button from the input to the ground, then set the "pull up". This is also the preferred way to connect a pushbutton/switch because the ground is everywhere but the +3.3V not.
Remember, if you try to register the button activity via interrupt or so, you may easily experience "bounces". That is, when you press the button, you'll see several unexpected "on/off" events, which are undesired. Those bounces are due to the mechanical structure of the button.
There are two ways to solve this problem:
- add an external capacitor (e.g. 100nF or more, not critical) across the button. This is an "hardware filter".
- do NOT use the interrupt, and implement a "digital filter" by sampling the state of the input periodically, then detect the stable state. In this case you won't need a capacitor.
Bear in mind, for a quick test on a breadboard, there's no problems at all. Once you'd create a reliable definitive circuit, I'd use both the filter ways: capacitor and sampling. Bullet-proof!
Good luck!
Go to the full post