User avatar
tadd
Posts: 15
Joined: Wed Dec 17, 2014 5:15 am
Location: Raleigh, NC
Contact: Website

GPIO from command line

Wed Dec 17, 2014 5:21 am

I am trying to do the first thing with GPIOs, that is, turning one on.
It seems I'm missing something or I skipped a lesson. What do I have to do to get the gpio command to work from the command line, bash, logged in a terminal?
When I type
gpio
I get
-bash: gpio: command not found
There is no manpage for gpio.
I'm using Debian Wheezy on a Raspberry PI B

User avatar
rpdom
Posts: 14468
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: GPIO from command line

Wed Dec 17, 2014 6:28 am

You'll need to install the Wiring Pi utilities from http://wiringpi.com/

There are full instructions on how to download and install them on that site.

User avatar
aTao
Posts: 1086
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: GPIO from command line

Wed Dec 17, 2014 6:37 am

You dont even need "gpio" package. The RPi GPIOs can be accessed as files. Have a look at https://sites.google.com/site/semillero ... rials/gpio
>)))'><'(((<

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: GPIO from command line

Wed Dec 17, 2014 6:08 pm

If you want the gpio command to work then you need wiringpi, but you can manipulate it using files as has been said.

example bash script using nothing but the built in software to flash an led connected to gpio 9 :

Code: Select all

#!/bin/bash
echo 9 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio9/direction
while [[ : ]]
  do 
    echo 1 > /sys/class/gpio/gpio9/value
    sleep 1
    echo 0 > /sys/class/gpio/gpio9/value
    sleep 1
done
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

Return to “Beginners”