Hello.
I'm having some problems figuring out how to connect 3 buttons. I know how to connect one button, but the problem in this case is that one pole of the three buttons are connected (see picture). The buttons are soldered on a circuit board i got from an old STB. How should i connect this to the Netduino? How should i code it using interrupt ports?
Please help me.
Help connecting and triggering 3 buttons
Started by Budisha, Dec 28 2011 06:25 PM
5 replies to this topic
#1
Posted 28 December 2011 - 06:25 PM
#2
Posted 28 December 2011 - 07:24 PM
Hi Budisha and welcome to the Netduino forums!
The common pin (those 3 connected to each other) should go to ground.
The other pins can go directly to netduino, for example on pins D0, D1 and D2.
You could use these 3 lines of code:
The common pin (those 3 connected to each other) should go to ground.
The other pins can go directly to netduino, for example on pins D0, D1 and D2.
You could use these 3 lines of code:
InterruptPort button1 = new InterruptPort(Pins.GPIO_PIN_D0, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth); InterruptPort button2 = new InterruptPort(Pins.GPIO_PIN_D1, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth); InterruptPort button3 = new InterruptPort(Pins.GPIO_PIN_D2, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#3
Posted 28 December 2011 - 07:31 PM
Hello, Stefan.
Thanks for your help. It worked.
I already tried connecting it this way and it didnt work. But i guess that was because i set the resistor mode to disabled.
#4
Posted 29 December 2011 - 12:11 AM
Hi Budisha,
By setting your resistor mode to PullUp as recommended by Stefan, you're effectively putting a little bit of current onto the pin. This way, when the button is pushed and a 0V (GND) signal is asserted...your Netduino can tell the difference.
Chris
#5
Posted 29 December 2011 - 12:04 PM
Thanks for the explanation, Chris.
I've been having a hard time understanding what the resistor mode does.
#6
Posted 29 December 2011 - 12:33 PM
Hi Budisha ,
It's best explained at http://en.wikipedia....ull-up_resistor
When using Port.ResistorMode.PullUp, the Netduino will emulate that circuit, so it always has a value.
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users