OLIMEX© 2012
OLinuXino-MAXI user's manual
Note: on different Linux distributions you might have different tools installed and you will probably
need to install dependencies needed for the compile/build scripts. Here are some (but not all) of the
mandatory ones: G++; diffstat; texi2html; chrpath; gawk; texinfo; some git client.
To ensure you have the latest version supported with all the updates visit
https://github.com/OLIMEX/OLINUXINO
and
https://github.com/Freescale/fsl-community-bsp-
platform
.
2.8 How to blink the LED
In this sub-chapter you will find a way to achieve the most basic task in electronics – the “Hello
World” of electronics - blinking the LED.
First we set the pin responsible for the LED as an output and we can set its value manually to high
or low position – make it blink manually. The LED mounted on the board uses GPIO65. You can
use external diode instead of the one mounted - you have to look at the table “The Linux
implementation of pins” in the hardware section to get the correct linux name for the GPIO pin.
echo out > /sys/class/gpio/gpio65/direction
echo 1 > /sys/class/gpio/gpio65/value
If you want to set the blink off you should change the value on the second line to:
echo 0 > /sys/class/gpio/gpio65/value
To show the info for all GPIOs:
ls /sys/class/gpio
To make it turn on – turn off automatically (e.g. blink) we use the text redactor VI to write the
Linux script:
echo out > /sys/class/gpio/gpio65/direction
while true
do
echo 1 > /sys/class/gpio/gpio65/value
sleep 1
echo 0 > /sys/class/gpio/gpio65/value
sleep 1
done
We save it as as “gpio” and we make it executable with
Page 14 of 60