Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Help connecting and triggering 3 buttons


  • Please log in to reply
5 replies to this topic

#1 Budisha

Budisha

    New Member

  • Members
  • Pip
  • 9 posts

Posted 28 December 2011 - 06:25 PM

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.

Posted Image

#2 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

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:
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

#3 Budisha

Budisha

    New Member

  • Members
  • Pip
  • 9 posts

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 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

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 Budisha

Budisha

    New Member

  • Members
  • Pip
  • 9 posts

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 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.