Olimex Open Source Hardware Embedded ARM Linux Single board computer with i.MX233 ARM926J @454Mhz IMX233-OLINUXINO-MICRO IMX233-OLINUXINO-MICRO 用户手册

产品代码
IMX233-OLINUXINO-MICRO
下载
页码 47
OLIMEX© 2012
OLinuXino-MICRO user's manual
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
chmod +x gpio
then we execut the script with:
./gpio
The LED should start blinking with 0.5Hz.
2.9 How to setup Arch Linux distribution
You can refer to the manual of OLinuXino-MAXI for general build instructions but mind we 
haven't tested the algorithm listed there on the MICRO. There shouldn't be significant differences. If 
you meet such head over to the OLIMEX forums.
Page 13 of 47