This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I use the GPIO?
#1
Hi, I finally registered on this board because I am rather frustrated with something I've been bashing my head against for 6 months now.

How do I use the GPIO on the TinkerBoard?

I've followed the information here:
tinkerboarding.co.uk/wiki/index.php?title=GPIO
And find it inaccurate and confusing.

For example, the first line states:
Code:
[color=#000000][font=monospace, Courier]wget http: //github.com/TinkerBoard/gpio_lib_python/archive/sbc/tinkerboard/python.zip GPIO_API_for_Python.zip[/font][/color]
[color=#000000][font=monospace, Courier]
[/font][/color]
(I added a space because the forum was complaining about clickable links)

I have no idea what the "GPIO_API_for_Python.zip" is there for, but I added it anyway. Obviously it fails to download. I ignored this.

The next step says:
Code:
[/font][/color][/font][/color]
[color=#000000][font=monospace, Courier][color=#000000][font=monospace, Courier][color=#000000][font=monospace, Courier]sudo apt-get install python-dev
unzip GPIO_API_for_Python.zip
cd GPIO_API_for_Python/
sudo Python setup.py install[/font][/color][/font][/color][/font][/color]
[color=#000000][font=monospace, Courier][color=#000000][font=monospace, Courier][color=#000000][font=monospace, Courier]
[/font][/color]
I install python-dev, then I try to unzip "GPIO_API_for_Python.zip"... Problem, I don't have any such file... I cannot find any such file anywhere on the internet either.
I did find another file called TinkerBoard.gpio-0.1.zip though which seems to be the same file, just with a different name. I have also seen this referenced as "ASUSTinkerBoard.gpio-0.1.zip"

Anyway, I unzip this file, CD into it and try to sudo Python setup.py install
I get "Sudo: Python: command not found"
I try changing "Python" to "python" and I get traceback errors.


How do I use the GPIO? I'm really confused, it's not this hard on other sbc devices.

E: why does all that font / color bbcode nonsense get added to my post?
Reply
#2
You need to install libraries first:
sudo apt-get install python-dev python2.7-dev python3-dev git
git clone https://github.com/TinkerBoard/gpio_lib_python.git
cd _folder_
sudo python setup.py install

Than you can use GPIO in your Python code.

test.py:
import ASUS.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)

pin = 40
GPIO.setup(pin, GPIO.OUT)
GPIO.output(pin, True)
GPIO.output(pin, False)
GPIO.cleanup()

Run:
sudo python test.py
Reply
#3
(05-13-2018, 02:54 AM)imperf3kt Wrote:
Code:
wget http: //github.com/TinkerBoard/gpio_lib_python/archive/sbc/tinkerboard/python.zip GPIO_API_for_Python.zip
(I added a space because the forum was complaining about clickable links)

I have no idea what the "GPIO_API_for_Python.zip" is there for, but I added it anyway. Obviously it fails to download. I ignored this.

(05-13-2018, 02:54 AM)imperf3kt Wrote: The next step says:
Code:
sudo apt-get install python-dev
unzip GPIO_API_for_Python.zip
cd GPIO_API_for_Python/
sudo Python setup.py install
I install python-dev, then I try to unzip "GPIO_API_for_Python.zip"... Problem, I don't have any such file... I cannot find any such file anywhere on the internet either.
I did find another file called TinkerBoard.gpio-0.1.zip though which seems to be the same file, just with a different name. I have also seen this referenced as "ASUSTinkerBoard.gpio-0.1.zip"

Can you success to download the file from this url?
http://github.com/TinkerBoard/gpio_lib_python/archive/sbc/tinkerboard/python.zip

This link provided the archive zip from git repo source codes.
And then when use this command,
Code:
wget http: //github.com/TinkerBoard/gpio_lib_python/archive/sbc/tinkerboard/python.zip GPIO_API_for_Python.zip
It would start downloading and save it name as GPIO_API_for_Python.zip.

(05-13-2018, 02:54 AM)imperf3kt Wrote: Anyway, I unzip this file, CD into it and try to sudo Python setup.py install
I get "Sudo: Python: command not found"
I try changing "Python" to "python" and I get traceback errors.

That is the typo on wiki, it should be all lowercase. like:
Code:
sudo python setup.py
Reply
#4
Or you can try with this steps, provide from ASUS's website.
https://www.asus.com/Single-Board-Computer/Tinker-Board/

Python

Python is a programming language that lets you work quickly and integrate systems more effectively.

1. Open a terminal and Install dependency package.
sudo apt-get update
sudo apt-get install python-dev python3-dev

2. Download Python GPIO library*
git clone http://github.com/TinkerBoard/gpio_lib_python.git

3. Navigate to folder
cd gpio_lib_python/

4. Install Python GPIO library for Tinker Board S
sudo python setup.py install
sudo python3 setup.py install 

*If get “git command not found”, please install git first by apt with follow commands. 
sudo apt-get update
sudo apt-get install git
Reply
#5
Sorry about the late reply, forgot I posted this.

I have previously tried all the suggestions made here and none of them work for me.

A friend at another forum thinks that there is a problem with the setup.py file.
I will try his suggestions later (delete line 41 and 58, IIRC)

Thank you for the replies. I will try all steps again from a clean 2.0.5 install just in case.

E:
Okay, after retrying the steps outlined above I can say that they worked perfectly.
I believe my issue was with step 2, this works:
git clone http://github.com/TinkerBoard/gpio_lib_python.git

This, does not work:

wget http: //github.com/TinkerBoard/gpio_lib_python/archive/sbc/tinkerboard/python.zip

I will pretend the wiki does not exist from now on and search directly at ASUS website from now on, thank you very much for the help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)