<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>BeagleBone Web Server - LED Blinking</title><link>/products/devtools/single-board-computers/next-genbeaglebone/b/blog/posts/beaglebone-web-server---led-blinking</link><description>Table of Contents Setup LED Blinking MySQL Installation Temperature Sensor IntroductionIn the previous article , we set up the BeagleBone to be a webserver running Lighttpd and PHP. In this article, we are going to build upon that foundation. We...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: BeagleBone Web Server - LED Blinking</title><link>https://community.element14.com/products/devtools/single-board-computers/next-genbeaglebone/b/blog/posts/beaglebone-web-server---led-blinking</link><pubDate>Tue, 18 Jul 2017 02:41:25 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:f23580fc-a5f0-4703-8d25-a277e9390e16</guid><dc:creator>robs7</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Hello,&lt;/p&gt;&lt;p&gt;I want to follow your tutorial but I&amp;#39;m having problems turning the led on and off, I&amp;#39;ve done the setup and now it&amp;#39;s the led turn but i&amp;#39;m having problems with it. I am using python to switch the led and the code work just fine:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;import Adafruit_BBIO.GPIO as GPIO&lt;/p&gt;&lt;p&gt;GPIO.setup(&amp;quot;P9_12&amp;quot;,GPIO.OUT)&lt;/p&gt;&lt;p&gt;GPIO.output(&amp;quot;P9_12&amp;quot;GPIO.HIGH)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Now, in the web page I have this code:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;lt;body&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;?php&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(isset($_GET["on"])){&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec(&amp;quot;python turnOn.py&amp;quot;);}&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ?&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;form method = &amp;quot;get&amp;quot;&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;button type = &amp;quot;button&amp;quot; onclick=&amp;quot;location.href=&amp;#39;on-off.php?on=true&amp;#39;&amp;quot;&amp;gt;ON&amp;lt;/button&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/form&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;/body&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;According to my logic this should turn the led on since I use the button to run the python program directly, the web page refreshes correctly but there is no change on the led.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;If yoy can help I would really aprecciate it. Thanks!&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=16578&amp;AppID=80&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: BeagleBone Web Server - LED Blinking</title><link>https://community.element14.com/products/devtools/single-board-computers/next-genbeaglebone/b/blog/posts/beaglebone-web-server---led-blinking</link><pubDate>Tue, 23 Sep 2014 06:10:04 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:f23580fc-a5f0-4703-8d25-a277e9390e16</guid><dc:creator>Former Member</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I&amp;#39;m using Rev C with Debian, after some changes on both CPP and PHP file they can be execute on BBB, but there is a broblem : in console ledctl app work correct only with &amp;quot;sudo&amp;quot; but in web page there isn&amp;#39;t any effect on leds.&lt;/p&gt;&lt;p&gt;I changed&amp;nbsp; permission of ledctl but still doesn&amp;#39;t work.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=16578&amp;AppID=80&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: BeagleBone Web Server - LED Blinking</title><link>https://community.element14.com/products/devtools/single-board-computers/next-genbeaglebone/b/blog/posts/beaglebone-web-server---led-blinking</link><pubDate>Wed, 20 Aug 2014 15:08:47 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:f23580fc-a5f0-4703-8d25-a277e9390e16</guid><dc:creator>Former Member</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;I am also having issues getting the LEDs to blink. The PHP page loads fine, clicking the buttons reloads the page just fine, and I&amp;#39;m nearly 100% that the PHP page is executing the program, but still, no blinking.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The reason I&amp;#39;m so sure that the code is being executed, is that I replaced the suggested program here with one that toggles all 4 leds simultaneously for 20 seconds. When I run that particular php page, the reload takes exactly 20 seconds (as opposed to nearly instantaneously for the code that simply turns on or off a single LED).&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I originally had my programs in /var/www/cgi-bin, because that is where lighttpd created the /www/ folder. I gave the cgi-bin folder 777 permissions. No dice.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;So I moved the programs to /www/cgi-bin, and gave /www/, /cgi-bin/, and all the programs full permission. No dice. But really, executing the program is probably not the issue.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;So I went to each /sys/class/leds/beaglebone:green:usr* folder, and gave 666 permissions to each ones brightness. Then, I gave full permissions to each of the containing folders (/sys/class/leds/beaglebone:green:usr*/ . Still it does not work.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I&amp;#39;m using Debian, if that helps.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=16578&amp;AppID=80&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: BeagleBone Web Server - LED Blinking</title><link>https://community.element14.com/products/devtools/single-board-computers/next-genbeaglebone/b/blog/posts/beaglebone-web-server---led-blinking</link><pubDate>Fri, 23 May 2014 06:38:22 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:f23580fc-a5f0-4703-8d25-a277e9390e16</guid><dc:creator>Former Member</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;i am really confused to creat the code for turn on/off the extrnal led (gpio(pin port)) so based on the code which given in this page, do i have to chage the red line? also do i have to chage html(ledctl.php)&amp;#39;s code too?&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;#include &amp;lt;fcntl.h&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;#include &amp;lt;unistd.h&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;int main(int argc, const char *argv[])&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;{if (argc != 3)&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;{printf(&amp;quot;Usage:\n&amp;quot;);&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;printf(&amp;quot;\tledCtl &amp;lt;led&amp;gt; &amp;lt;on/off&amp;gt;\n&amp;quot;);&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;printf(&amp;quot;\n&amp;quot;);&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;printf(&amp;quot;&lt;/span&gt;&lt;span lang="EN-US"&gt;&amp;lt;led&amp;gt;&amp;nbsp; : Number between 0-3\n&amp;quot;); &lt;/span&gt;&lt;span lang="EN-US"&gt;//Change to pin port number?&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;printf(&amp;quot;&amp;lt;on/off&amp;gt;: 1 = on, 0 = off\n&amp;quot;);&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;return 1;&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;int ledNum = atoi(argv[1]);&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;if (ledNum &amp;lt; 0 || ledNum &amp;gt; 3) &lt;/span&gt;&lt;span lang="EN-US"&gt;//change to pin number?&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;{&lt;/span&gt;&lt;span lang="EN-US"&gt;printf(&amp;quot;&amp;lt;led&amp;gt;&amp;nbsp; : Number between 0-3\n&amp;quot;);&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;return 1;&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;char ledPath[1024];&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;sprintf(ledPath, &amp;quot;/sys/class/leds/beaglebone::usr%d/brightness&amp;quot;, ledNum);&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;int fid = open(ledPath, O_WRONLY);&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;int onOff = atoi(argv[2]);&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;switch (onOff)&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;{case 0:&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;write(fid, &amp;quot;0&amp;quot;, 1);&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;break;&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;case 1:&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;write(fid, &amp;quot;1&amp;quot;, 1);&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;break;&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;default:&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;printf(&amp;quot;&amp;lt;on/off&amp;gt;: 1 = on, 0 = off\n&amp;quot;);&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;return 1;}&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;close(fid);&lt;/span&gt;&lt;/p&gt;&lt;p class="0"&gt;&lt;span lang="EN-US"&gt;return 0;}&lt;/span&gt;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=16578&amp;AppID=80&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: BeagleBone Web Server - LED Blinking</title><link>https://community.element14.com/products/devtools/single-board-computers/next-genbeaglebone/b/blog/posts/beaglebone-web-server---led-blinking</link><pubDate>Sun, 18 May 2014 14:06:40 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:f23580fc-a5f0-4703-8d25-a277e9390e16</guid><dc:creator>Former Member</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;&lt;br /&gt;when i type g++ ledctl.cpp -o /www/cgi-bin/ledctl i have errors.&lt;span&gt;[View:/resized-image/__size/620x117/__key/commentfiles/f7d226abd59f475c9d224a79e3f0ec07-f23580fc-a5f0-4703-8d25-a277e9390e16/4520.contentimage_5F00_176075.jpg:620:117]&lt;/span&gt;&lt;/p&gt;&lt;p&gt;what should i do?&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=16578&amp;AppID=80&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: BeagleBone Web Server - LED Blinking</title><link>https://community.element14.com/products/devtools/single-board-computers/next-genbeaglebone/b/blog/posts/beaglebone-web-server---led-blinking</link><pubDate>Fri, 18 Apr 2014 20:12:58 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:f23580fc-a5f0-4703-8d25-a277e9390e16</guid><dc:creator>Former Member</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Hello I´m having some problems, If you could help I´d be very grateful. (Sorry for my english)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;First I have apache2 and php.&amp;nbsp; In beaglebone it runs ok and the led turns on or off, but y have to do:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;./ledctl 2 2 &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;if y I only do:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;ledctl 2 2&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;This message appear:&amp;quot;-bash: ledctl: command not found&amp;quot;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;When I run the php code, and I click a bottom, this appear http://192.168.1.2/ledCtl.php?led=3&amp;amp;onOff=1&lt;/p&gt;&lt;p&gt; but nothing happens in the beaglebone, the led doesn´t turn on. In the php code I have:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;exec( &amp;quot;/var/www/cgi-bin/ledctl $led $onOff&amp;quot; );&lt;/p&gt;&lt;p&gt;&lt;span&gt;(and I´ve also probe with:&amp;nbsp; &lt;span&gt;exec( &amp;quot;root/ledctl $led $onOff&amp;quot; );&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I have a Debian distribution in the BeagleBone. Please help me. thank you very much.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=16578&amp;AppID=80&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: BeagleBone Web Server - LED Blinking</title><link>https://community.element14.com/products/devtools/single-board-computers/next-genbeaglebone/b/blog/posts/beaglebone-web-server---led-blinking</link><pubDate>Mon, 31 Mar 2014 18:53:09 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:f23580fc-a5f0-4703-8d25-a277e9390e16</guid><dc:creator>Former Member</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Thank you !&lt;/p&gt;&lt;p&gt;I have a question. I&amp;#39;m newbie. In application use to test webpage, i write by java. And I don&amp;#39;t know execute java application in webpage(example: test.php). Can you help me?&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=16578&amp;AppID=80&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: BeagleBone Web Server - LED Blinking</title><link>https://community.element14.com/products/devtools/single-board-computers/next-genbeaglebone/b/blog/posts/beaglebone-web-server---led-blinking</link><pubDate>Fri, 22 Nov 2013 11:17:51 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:f23580fc-a5f0-4703-8d25-a277e9390e16</guid><dc:creator>Former Member</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Please don&amp;#39;t camel case anything that&amp;#39;s a filename. The case sensitive filesystems you find on linux make this unuseable very quickly and no other normal unix commands do it. You&amp;#39;d also be amazed at how many times I&amp;#39;ve had to fix someones php code after they&amp;#39;ve camel cased all the php script names inside the code then found that when they uploaded the files from their case-insensitive windows machine to the case sensitive linux host nothing works. Stick to lowercase everywhere and people trying to follow the article will thank you instead of wondering why it doesn&amp;#39;t work.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Also the led names you&amp;#39;re using are not stable, in a future version you&amp;#39;re going to find that usr0 changes to heartbeat and usr1 changes to mmc0. &lt;/p&gt;&lt;p&gt;This has the interesting side effect that the official emmc updaters fail to turn on all the led&amp;#39;s when they&amp;#39;re done as they currently only check for usr0&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;If you&amp;#39;re seeing the BBW not having &amp;#39;green&amp;#39; as part of one of the leds names, then it seems that every different kernel has a different set of names. Unfortunately that really means your code needs to enumerate the contents of the directory and use the names it finds. That probably also gives you a problem with using numeric references to the leds as there doesn&amp;#39;t seem to be a simple way to find out that heartbeat = usr0 or whatever currently unknown naming convention might be used in the future.&lt;/p&gt;&lt;p&gt;On the BBB you can try to look at /sys/kernel/debug/gpio but this gives truncated names as follows:&lt;/p&gt;&lt;blockquote class="jive-quote"&gt;
&lt;p&gt;GPIOs 32-63, gpio:&lt;/p&gt;
&lt;p&gt; gpio-53&amp;nbsp; (beaglebone:green:hea) out lo&lt;/p&gt;
&lt;p&gt; gpio-54&amp;nbsp; (beaglebone:green:mmc) out lo&lt;/p&gt;
&lt;p&gt; gpio-55&amp;nbsp; (beaglebone:green:usr) out hi&lt;/p&gt;
&lt;p&gt; gpio-56&amp;nbsp; (beaglebone:green:usr) out lo&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;note the number is truncated as the led name is too long.. and that file isn&amp;#39;t valid on BBW as it doesn&amp;#39;t use devicetree, so isn&amp;#39;t a general solution anyway.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;For the simple echo commands you could use echo 1 &amp;gt; /sys/class/leds/*usr2 &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I note that you only change the brightness value for the leds, on my BBB all of the leds have a trigger associated with them, so simply changing the brightness value won&amp;#39;t have the effect of turning the led on/off unless the trigger never runs.&amp;nbsp; So you might want to change the trigger to &amp;#39;none&amp;#39; or &amp;#39;default-on&amp;#39; as well.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;On the escaping of the colon, quoting and escaping conventions can be confusingly complex and may depend on which shell you&amp;#39;re using. In your fairly simple usage, with bash as the shell you don&amp;#39;t need it. In other uses you might have a filename inside quotes or something similar where the outer layer changes the meaning of some character or sequence of characters and the escape becomes necessary to make it do the right thing. The tab completion is trying to be conservative and give you something that&amp;#39;ll work in all circumstances.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;For file extensions, in windows you can type &amp;quot;ledCtl&amp;quot; and it&amp;#39;ll find and run &amp;quot;ledctl.exe&amp;quot; in the current directory, if your program was just called &amp;quot;ledCtl&amp;quot; (no extension) then windows won&amp;#39;t run it as it uses the extension to work out what&amp;#39;s an executable file. Unix doesn&amp;#39;t do that. If you name it &amp;quot;ledCtl.exe&amp;quot; then you need to type the whole thing. Also, if the ledCtl.exe file on the linux machine doesn&amp;#39;t have the executable permission then it won&amp;#39;t be executed. Run &amp;#39;chmod ugo-x ledCtl.exe&amp;#39; then try to run it, you won&amp;#39;t be able to. It&amp;#39;s not so much that using a file extension isn&amp;#39;t the convention on unix, it&amp;#39;s more that the filename has no part in deciding if the file is executable or not. Unlike on windows where the filenames extension is the deciding factor. (ok, windows is more complex, you need the associations setup in the registry as well, but you get the idea)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;In your php code, you have exec( &amp;quot;/home/root/ledCtl.exe $led $onOff&amp;quot; );&amp;nbsp; I know you&amp;#39;re using angstrom, but probably worth pointing out that most other distros don&amp;#39;t use /home/root more usually it&amp;#39;ll be just /root&lt;/p&gt;&lt;p&gt;In addition, typically a webserver doesn&amp;#39;t run as root and so won&amp;#39;t be able to see or execute an application that&amp;#39;s not in the cgi directory or some other directory under the webservers home directory. Unfortunately lighttpd fails to install on my BBB so it&amp;#39;s impossible to see if they&amp;#39;re doing something insane like running it as root in order to make this work.&amp;nbsp; I&amp;#39;ve replied to your previous post with some ideas around the hang on installing lighttpd.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Lastly, why are you using g++ (and a *.cpp filename) for what&amp;#39;s clearly a plain C program ?&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=16578&amp;AppID=80&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: BeagleBone Web Server - LED Blinking</title><link>https://community.element14.com/products/devtools/single-board-computers/next-genbeaglebone/b/blog/posts/beaglebone-web-server---led-blinking</link><pubDate>Fri, 22 Nov 2013 02:07:41 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:f23580fc-a5f0-4703-8d25-a277e9390e16</guid><dc:creator>morgaine</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Some odd Windows&amp;#39;isms and Windows-inspired typos seem to have crept into this article:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;BeagleBone:&lt;p&gt;echo 1 &amp;gt; /sys/class/leds/beaglebone\:\:usr2/brightness&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The &amp;#39;:&amp;#39; is not a shell metacharacter and so it doesn&amp;#39;t need escaping with a backslash.&amp;nbsp; Although this will still work, the colour field &amp;quot;green&amp;quot; is missing so overall it fails.&amp;nbsp; The command should be:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;BeagleBone:&lt;p&gt;echo 1 &amp;gt; /sys/class/leds/beaglebone:green:usr2/brightness&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;For the BeagleBone Black, you included the &amp;quot;green&amp;quot; field but you used a Windows-style path separator:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;BeagleBone Black:&lt;p&gt;echo 1 &amp;gt; /sys/class/leds/beaglebone\:green\:usr2\brightness&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;That won&amp;#39;t work at all.&amp;nbsp; It should be:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;BeagleBone Black:&lt;p&gt;echo 1 &amp;gt; /sys/class/leds/beaglebone:green:usr2/brightness&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Finally, your compile command added superfluous Windows-type file suffices:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;blockquote class="jive-quote"&gt;
&lt;p&gt;To compile the code, type:&lt;br /&gt;&lt;br /&gt;g++ ledCtl.cpp -o ledCtl&lt;strong&gt;.exe&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Then we can run some examples and make sure that it works:&lt;br /&gt;&lt;br /&gt;./ledCtl&lt;strong&gt;.exe&lt;/strong&gt;&lt;br /&gt;./ledCtl&lt;strong&gt;.exe&lt;/strong&gt; 2 1&lt;br /&gt;./ledCtl&lt;strong&gt;.exe&lt;/strong&gt; 2 0&lt;/p&gt;

&lt;/blockquote&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Although this will work, it&amp;#39;s inherently confusing and immediately makes readers wonder on what platform your code was running.&amp;nbsp; I recommend that you drop the &amp;quot;.exe&amp;quot; file suffices completely, as they&amp;#39;re not needed under Unix and they don&amp;#39;t respect the standard conventions.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Morgaine.&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=16578&amp;AppID=80&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>