GPIO pin pullup example?

Started by gazum, June 20, 2014, 02:36:44 AM

Previous topic - Next topic

gazum

Hello,

I need to connect a button to GPIO-2 pin and I am trying to pull it up.

According to fex file specs, I am adding following line


gpio_pin_3 = port:PB03<0><1><default><default>


to [gpio_para] section.

PB03 is supposed to be pin #11 on GPIO-2.


import time
import A13_GPIO as g
BTN = g.PIN2_11
g.init()
g.setcfg(BTN, g.INPUT)
while True:
    time.sleep(0.1)
    result = g.input(BTN)
    print time.time(), result


It reads zeros only and does not change when I press the button.

I can pullup this pin by using an external resistor, but it would be nice to use built-in functionality.

I have A13-Olinuxino Rev. C board.

Does anybody have a working example of how to pull a pin up via fex file?

Thank you.