3 * Make the OK LED on the Pi Pulsate...
4 * Copyright (c) 2012 gordon Henderson, but please Share and Enjoy!
6 * Originally posted to the Raspberry Pi forums:
7 * http://www.raspberrypi.org/phpBB3/viewtopic.php?p=162581#p162581
9 * Compile this and store it somewhere, then kick it off at boot time
10 * e.g. by putting it in /etc/rc.local and running it in the
30 if ((fd = open ("/sys/class/leds/led0/trigger", O_RDWR)) < 0)
32 fprintf (stderr, "Unable to change LED trigger: %s\n", strerror (errno)) ;
36 write (fd, "none\n", 5) ;
39 if (wiringPiSetupGpio () < 0)
41 fprintf (stderr, "Unable to setup GPIO: %s\n", strerror (errno)) ;
45 softPwmCreate (OK_LED, 0, 100) ;
49 for (i = 0 ; i <= 100 ; ++i)
51 softPwmWrite (OK_LED, i) ;
56 for (i = 100 ; i >= 0 ; --i)
58 softPwmWrite (OK_LED, i) ;