3 * Make the OK LED on the Pi Pulsate...
5 * Originally posted to the Raspberry Pi forums:
6 * http://www.raspberrypi.org/phpBB3/viewtopic.php?p=162581#p162581
8 * Compile this and store it somewhere, then kick it off at boot time
9 * e.g. by putting it in /etc/rc.local and running it in the
12 * Copyright (c) 2012-2013 Gordon Henderson. <projects@drogon.net>
13 ***********************************************************************
14 * This file is part of wiringPi:
15 * https://projects.drogon.net/raspberry-pi/wiringpi/
17 * wiringPi is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU Lesser General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
22 * wiringPi is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU Lesser General Public License for more details.
27 * You should have received a copy of the GNU Lesser General Public License
28 * along with wiringPi. If not, see <http://www.gnu.org/licenses/>.
29 ***********************************************************************
42 // The OK/Act LED is connected to BCM_GPIO pin 16
50 wiringPiSetupGpio () ;
52 // Change the trigger on the OK/Act LED to "none"
54 if ((fd = open ("/sys/class/leds/led0/trigger", O_RDWR)) < 0)
56 fprintf (stderr, "Unable to change LED trigger: %s\n", strerror (errno)) ;
59 write (fd, "none\n", 5) ;
62 softPwmCreate (OK_LED, 0, 100) ;
66 for (i = 0 ; i <= 100 ; ++i)
68 softPwmWrite (OK_LED, i) ;
73 for (i = 100 ; i >= 0 ; --i)
75 softPwmWrite (OK_LED, i) ;