点亮led【转载】
http://linux-sunxi.org/Cubieboard/Programming/StatusLEDs
Accessing the status LEDs
The Cubieboard has two status LEDs, a green one and a blue one. These can be accessed and switched on and off with the following instructions.
Preparation
You need to have a bootable image with a recent kernel (3.x).
Add the following lines to your script.bin
1
2
3
4
5
6
7
|
[leds_para] leds_used = 1 leds_num = 2 leds_pin_1 = port:PH20< 1 ><default><default>< 0 > leds_name_1 = "green:ph20:led1" leds_pin_2 = port:PH21< 1 ><default><default>< 0 > leds_name_2 = "blue:ph21:led2" |
Access
Enable an LED (blue, in this case):
echo 255 > /sys/class/leds/blue\:ph21\:led2/brightness
Switch off an LED (blue, in this case):
echo 0 > /sys/class/leds/blue\:ph21\:led2/brightness
Blinking an LED (blue, in this case):
echo timer > /sys/class/leds/blue\:ph21\:led2/trigger
Use an LED (blue, in this case) to show SD card activity
echo mmc0 > /sys/class/leds/blue\:ph21\:led2/trigger
For others available triggers, run the command
cat /sys/class/leds/blue\:ph21\:led2/trigger
实际使用:
echo 0 > /sys/devices/platform/leds-sunxi/leds/blue:ph21:led2/brightness
echo 255 > /sys/devices/platform/leds-sunxi/leds/blue:ph21:led2/brightness
确定是那个盒子。