Article Index

Page 44

#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
int main(int argc, char **argv)
{
    int fd = open("/sys/class/leds/ACT/trigger", O_WRONLY);
    write(fd, "none",4);
    close(fd);
    fd = open("/sys/class/leds/ACT/brightness", O_WRONLY);
    while (1)
    {
        write(fd, "0",1);
        sleep(2);
        write(fd, "1",1);
        sleep(2);
    }
}

Page 45

#include <stdio.h>
import io
from time import sleep

fd = io.open("/sys/class/leds/ACT/trigger","w")
fd.write("timer")
fd.close()

fd = io.open("/sys/class/leds/ACT/delay_on", "w")
fd.write("2000")
fd.close()

fd = io.open("/sys/class/leds/ACT/delay_off", "w")
fd.write("3000")
fd.close()