login|Register
Forum > Openelec
Post|
看30956|回26|Favorite
Boten 看全部
2016-9-26 19:27:15
Hello OrangePi Community,

I've got actually an Orange PI PC+ and i was wondering if there's a way to install GPIO in OpenElec ?

Regards.

jernej 看全部
2016-9-27 01:31:50
Pins are accessible trought sysfs. If you meant something like python libs, then you are right and there is no plugin yet. If you have time, you can help create one.
Boten 看全部
2016-9-27 03:01:24

quote:

jernej replied at 2016-9-27 01:31
Pins are accessible trought sysfs. If you meant something like python libs, then you are right and t ...

Can i use them to control my fan ? as i've got one.

If yes could you help me to do so ?

Thanks.
jernej 看全部
2016-9-27 04:03:38

quote:

Boten replied at 2016-9-26 20:01
Can i use them to control my fan ? as i've got one.

If yes could you help me to do so ?

I misconfigured GPIO module, so for now, you have to load driver first (it will be fixed soon):

code:

  1. modprobe gpio_sunxi

then check sysfs for all available pins (depends on script.bin):

code:

  1. ls /sys/class/gpio_sw

Choose one, for example PA0. Set it either to input (0) or output (1). This will set it as an output:

code:

  1. echo "1">/sys/class/gpio_sw/PA0/cfg

If you set it as an output, you can set state of the pin with writing 1 or 0:

code:

  1. echo "1">/sys/class/gpio_sw/PA0/data

Otherwise, you can read it:

code:

  1. cat /sys/class/gpio_sw/PA0/data


Please know that all these informations are based on a driver, so please tell if it works or not.

Boten 看全部
2016-9-27 06:34:50
Hello jerneg and thanks for your fast answer!

I followed your steps but i haven't been successful turning the fan on.i even activated all the pins via the two commands:

> echo "1">/sys/class/gpio_sw/PA0/cfg
> echo "1">/sys/class/gpio_sw/PA0/data

The FAN still off, is there schema of the pins and their numbers ?
1234.. 6NextPage

OrangePi En

Powered by Discuz! X3.4

homepage|Simple edition|Touch edition|PC