Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Missing option to add pull up or down to gpio pin #255

Closed
butlermatt opened this issue Oct 25, 2015 · 5 comments
Closed

Missing option to add pull up or down to gpio pin #255

butlermatt opened this issue Oct 25, 2015 · 5 comments
Assignees
Milestone

Comments

@butlermatt
Copy link

When using a gpio pin for input, particularly with switches, the value may sometimes be floating and may read true when there is no input even connected.

A solution is often to add a pull up or pull down resistor to the circuit and because it's so common, they are integrated into the Pi directly. The python sdk has an optional parameter to indicate if a pull up or down should be applied to the pin when it is set up. This is currently missing in the dart sdk and could greatly simplify circuits.

@sgjesse
Copy link
Contributor

sgjesse commented Oct 26, 2015

If you use the PiMemoryMappedGPIO in the raspberry_pipackage there is a way to use the internal pull up or pull down resistor.

See https://github.com/dart-lang/fletch/blob/master/pkg/raspberry_pi/lib/raspberry_pi.dart#L242.

(looking at the comment I can see it it was not updated after I changed an into to a enum).

It might be that the sysfs driver for the Raspberry Pi also support setting the pull up or pull down resistor.

@sgjesse
Copy link
Contributor

sgjesse commented Nov 2, 2015

Having looked further into this I don't think there is a way to set up the built-in pull up or pull down resistors through the sysfs interface.

If the built-in pull up or pull down resistors are used I think the best solution is to make sure they are configured before actually attaching anything to the pins.

@butlermatt
Copy link
Author

For using sysfs I found:
To set pull-up
echo 0 > /sys/class/gpio/gpio<pin#>/active_low

@mit-mit mit-mit added this to the 0.3.0 milestone Nov 13, 2015
@mit-mit
Copy link
Contributor

mit-mit commented Nov 13, 2015

tentatively including in 0.3

@sgjesse
Copy link
Contributor

sgjesse commented Dec 9, 2015

I am pretty sure that /sys/class/gpio/gpio<pin#>/active_low does not affect the internal pull-up/pull-down. The only way to access the pull-up/pull-down are through the memory mapped API.

@sgjesse sgjesse closed this as completed Dec 9, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants