0

I am facing exact same problem as asked here in this question. It's basically the "reading floating values" problem when pull-down resistors are not used.

I am unable to activate pull-down resistors through C# code.I tried various GpioPinDriveMode input modes and the following code, but none of them solved my problem. I still got random inputs from the GPIO pin.

pin.SetDriveMode(GpioDriveMode.InputPullDown);

Is this the wrong way to activate pull-down resistors? How do I do that?

Note that the problem is solved when I physically add a resistor in series. However I would like to use the inbuilt pull-down resistors available in R'pi.

Vijay Chavda
  • 163
  • 5

1 Answers1

1

Solved. I made a silly mistake on my part. Visual studio was running my old source even after I rebuilt then deployed it. I had to clean my solution and then run it, and It turned out to be Okay!

pin.SetDriveMode(GpioDriveMode.InputPullDown);

This line is definitely the correct way to activate pull-down resistors using C#.

Vijay Chavda
  • 163
  • 5