Skip to content

Instantly share code, notes, and snippets.

@ddewaele
Last active June 21, 2019 12:51
Show Gist options
  • Save ddewaele/dc3f15192201d13bbde4 to your computer and use it in GitHub Desktop.
Save ddewaele/dc3f15192201d13bbde4 to your computer and use it in GitHub Desktop.
Intel Edison blinking LED
echo out > /sys/class/gpio/gpio128/direction 
echo 1 > /sys/class/gpio/gpio128/value
echo 0 > /sys/class/gpio/gpio128/value

echo in > /sys/class/gpio/gpio129/direction 
cat /sys/class/gpio/gpio129/value

Connections

  • J17-14 : gpio128 : connected to the base of the transistor
  • J18-12 : gpio129 : connected to the button (connected to GND when not pressed)
  • J19-03 : GND : connect to the (-) of the power-rail
  • J20-01 : V_VSYS : 4.x V - connect to the (+) of the power-rail
echo 14 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio14/direction
echo 15 > /sys/class/gpio/export
echo in  > /sys/class/gpio/gpio15/direction
cat /sys/class/gpio/gpio15/value

echo 1 > /sys/class/gpio/gpio14/value
echo 0 > /sys/class/gpio/gpio14/value

Full output

root@ubilinux:~# cd /sys/class/gpio
root@ubilinux:/sys/class/gpio# ls -ltr
total 0
--w------- 1 root root 4096 Feb  4 21:32 export
--w------- 1 root root 4096 Feb  4 21:32 unexport
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpiochip0 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpiochip0
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio134 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio134
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio133 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio133
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio132 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio132
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio131 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio131
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio130 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio130
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio129 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio129
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio128 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio128
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio127 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio127
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio126 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio126
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio125 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio125
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio124 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio124
root@ubilinux:/sys/class/gpio# echo 14 > export
root@ubilinux:/sys/class/gpio# ls -ltr
total 0
--w------- 1 root root 4096 Feb  4 21:32 unexport
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpiochip0 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpiochip0
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio134 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio134
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio133 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio133
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio132 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio132
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio131 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio131
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio130 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio130
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio129 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio129
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio128 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio128
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio127 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio127
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio126 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio126
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio125 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio125
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio124 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio124
--w------- 1 root root 4096 Feb  4 21:32 export
lrwxrwxrwx 1 root root    0 Feb  4 21:32 gpio14 -> ../../devices/pci0000:00/0000:00:0c.0/gpio/gpio14
root@ubilinux:/sys/class/gpio# cd gpio14
root@ubilinux:/sys/class/gpio/gpio14# ls
active_low  device  direction  edge  power  subsystem  uevent  value
root@ubilinux:/sys/class/gpio/gpio14# echo out > direction
root@ubilinux:/sys/class/gpio/gpio14# echo 1 > value
root@ubilinux:/sys/class/gpio/gpio14# echo 0 > value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment