User avatar
AES256
Posts: 6
Joined: Sun May 03, 2015 10:37 am

Push Button Sample project question

Sun May 03, 2015 3:48 pm

My question is related to the Push Button Sample project (https://www.hackster.io/windowsiot/push-button-sample).

I'm trying to implement one of my Python codes in .NET.
I'm using a bit different hardware setup. I use a 4 pin tacticle button (http://www.hqelektronika.hu/newpic/2/10 ... 1798HQ.jpg), I connect button pin 1 to ground and button pin 3 to RPi2 GPIO22 pin. This setup was working very well under Raspbian, with the following python code:

Code: Select all

GPIO.setmode(GPIO.BOARD) ## Use board pin numbering
GPIO.setup(13, GPIO.IN, pull_up_down=GPIO.PUD_UP)
However when I'm trying to setup the pin with pull-up registers in .NET:

Code: Select all

            pushButton = gpio.OpenPin(PB_PIN);
            pushButton.SetDriveMode(GpioPinDriveMode.InputPullUp);
I get the following error message:

Code: Select all

An exception of type 'System.ArgumentException' occurred in <exename> but was not handled in user code
WinRT information: value': Invalid argument
Additional information: The parameter is incorrect.
Did anyone face the same issue when trying to use GpioPinDriveMode.InputPullUp instead of GpioPinDriveMode.Input?
Peter

Daniel7
Posts: 4
Joined: Mon May 04, 2015 7:14 am
Location: Niederrhein, Germany
Contact: Website

Re: Push Button Sample project question

Mon May 04, 2015 7:26 am

Hi,

according to the documentation only GpioPinDriveMode.Input and GpioPinDriveMode.Output are supported. The others are marked as "Not supported" (yet).

https://msdn.microsoft.com/en-us/librar ... emode.aspx

I think this Windows 10 preview has a very early version of the API and there is much to do for Microsoft.

For testing you can connect a hardeware resistor as PullUp:
http://netmf-tutorial.de/wp-content/upl ... ltplan.png

It's a sample for a microcontroller, but this works with the RPi, too. I've done this two days ago. You can read about it in my blog (in german):

http://netmf-tutorial.de/net-c-auf-dem- ... indows-10/

Daniel
http://netmf-tutorial.de

User avatar
AES256
Posts: 6
Joined: Sun May 03, 2015 10:37 am

Re: Push Button Sample project question

Tue May 05, 2015 3:09 pm

Daniel,

Thanks for the link to your tutorial.
Adding external pull-up resistor was my backup plan. Just tried to avoid using extra hardware in case of this simple setup.
I can only hope that the internal pull-up feature will be implemented (soon).

Do you maybe know if the 1-wire protocol was implemented in Windows 10 IoT? Would be nice to migrate my apps using the DS18B20 as well.

Thanks
Peter

Daniel7
Posts: 4
Joined: Mon May 04, 2015 7:14 am
Location: Niederrhein, Germany
Contact: Website

Re: Push Button Sample project question

Wed May 06, 2015 6:25 am

Hi Peter,

i have no experience with the 1-wire protocol but that sounds interesting. You should create a new thread with this question. :)

Daniel
http://netmf-tutorial.de

Return to “Windows 10 for IoT”