<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Blinking Morse code on LED]]></title><description><![CDATA[<p dir="auto">Here's a little fun one!  You can use the LED on the Omega to send messages in Morse code.</p>
<p dir="auto">To start, you'll need to install the <em>mod-ledtrig-morse</em> package:</p>
<pre><code>    opkg update &amp;&amp; opkg install mod-ledtrig-morse
</code></pre>
<p dir="auto">Once this is done, a kernel module that can translate text to Morse code and blink the LEDs is automatically installed.  But you still need to tell the kernel which LED you want to blink.  The kernel exposes a lot of hardware status and configuration options through a virtual filesystem under /sys.  (I.e. the files under /sys aren't <em>actually</em> files, but they look and act like files to make it very easy to access them from the command line and in scripts or programs.)</p>
<p dir="auto">To tell the kernel that we are going to use the new Morse code module, set the LED trigger condition for the Onion system LED to "<em>morse</em>" by using the "<em>echo</em>" command to write the setting into the virtual file:</p>
<pre><code>    echo morse &gt; /sys/class/leds/onion\:amber\:system/trigger
</code></pre>
<p dir="auto">You can verify that it worked by using '<em>cat</em>' to look at the virtual file:</p>
<pre><code>    root@Omega-12D9:~# cat /sys/class/leds/onion\:amber\:system/trigger 
    none timer default-on netdev transient gpio heartbeat [morse] oneshot usbdev phy0rx phy0tx phy0assoc phy0radio phy0tpt
</code></pre>
<p dir="auto">You can see that "morse" is selected because it's in brackets.  The other text in that file shows the other available options that this particular bit of the kernel can be set to.</p>
<p dir="auto">Anyway, now we have everything set up!  We just need to tell the kernel what message to blink on the LED.  Conveniently, once the morse option is selected, the kernel creates a new virtual file for that called (unsurprisingly enough) "<em>message</em>".  We can use "<em>echo</em>" again to put text there:</p>
<pre><code>    echo Hello, Onion &gt; /sys/class/leds/onion\:amber\:system/message
</code></pre>
<p dir="auto">Now watch your LED!  If it's too fast or too slow, you can change the speed with the "<em>delay</em>" file that also gets created.  E.g.</p>
<pre><code>    root@Omega-12D9:~# cat /sys/devices/platform/leds-gpio/leds/onion\:amber\:system/delay 
    50
    
    # That's pretty fast!  Let's slow it down a bit so that people like me who aren't experts can read it:
    root@Omega-12D9:~# echo 100 &gt; /sys/devices/platform/leds-gpio/leds/onion\:amber\:system/delay 
</code></pre>
<p dir="auto">The message will keep looping forever or until you change it.  To stop it, you can either clear the message entirely:</p>
<pre><code>    echo &gt; /sys/class/leds/onion\:amber\:system/message
</code></pre>
<p dir="auto">or change the LED trigger to something else:</p>
<pre><code>    echo default-on &gt; /sys/class/leds/onion\:amber\:system/trigger
</code></pre>
<p dir="auto">Feel free to try some of the other options as well!  Remember that you can view the available options by using "<em>cat</em>" as mentioned above.  (The "<em>heartbeat</em>" option is fun too.)</p>
<p dir="auto">There are many more settings status files available for other devices in /sys and it can be a great way to learn about working with hardware under Linux.</p>
]]></description><link>http://community.onion.io/topic/305/blinking-morse-code-on-led</link><generator>RSS for Node</generator><lastBuildDate>Mon, 11 May 2026 20:47:00 GMT</lastBuildDate><atom:link href="http://community.onion.io/topic/305.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 19 Dec 2015 19:03:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Blinking Morse code on LED on Sat, 19 Dec 2015 19:03:12 GMT]]></title><description><![CDATA[<p dir="auto">Here's a little fun one!  You can use the LED on the Omega to send messages in Morse code.</p>
<p dir="auto">To start, you'll need to install the <em>mod-ledtrig-morse</em> package:</p>
<pre><code>    opkg update &amp;&amp; opkg install mod-ledtrig-morse
</code></pre>
<p dir="auto">Once this is done, a kernel module that can translate text to Morse code and blink the LEDs is automatically installed.  But you still need to tell the kernel which LED you want to blink.  The kernel exposes a lot of hardware status and configuration options through a virtual filesystem under /sys.  (I.e. the files under /sys aren't <em>actually</em> files, but they look and act like files to make it very easy to access them from the command line and in scripts or programs.)</p>
<p dir="auto">To tell the kernel that we are going to use the new Morse code module, set the LED trigger condition for the Onion system LED to "<em>morse</em>" by using the "<em>echo</em>" command to write the setting into the virtual file:</p>
<pre><code>    echo morse &gt; /sys/class/leds/onion\:amber\:system/trigger
</code></pre>
<p dir="auto">You can verify that it worked by using '<em>cat</em>' to look at the virtual file:</p>
<pre><code>    root@Omega-12D9:~# cat /sys/class/leds/onion\:amber\:system/trigger 
    none timer default-on netdev transient gpio heartbeat [morse] oneshot usbdev phy0rx phy0tx phy0assoc phy0radio phy0tpt
</code></pre>
<p dir="auto">You can see that "morse" is selected because it's in brackets.  The other text in that file shows the other available options that this particular bit of the kernel can be set to.</p>
<p dir="auto">Anyway, now we have everything set up!  We just need to tell the kernel what message to blink on the LED.  Conveniently, once the morse option is selected, the kernel creates a new virtual file for that called (unsurprisingly enough) "<em>message</em>".  We can use "<em>echo</em>" again to put text there:</p>
<pre><code>    echo Hello, Onion &gt; /sys/class/leds/onion\:amber\:system/message
</code></pre>
<p dir="auto">Now watch your LED!  If it's too fast or too slow, you can change the speed with the "<em>delay</em>" file that also gets created.  E.g.</p>
<pre><code>    root@Omega-12D9:~# cat /sys/devices/platform/leds-gpio/leds/onion\:amber\:system/delay 
    50
    
    # That's pretty fast!  Let's slow it down a bit so that people like me who aren't experts can read it:
    root@Omega-12D9:~# echo 100 &gt; /sys/devices/platform/leds-gpio/leds/onion\:amber\:system/delay 
</code></pre>
<p dir="auto">The message will keep looping forever or until you change it.  To stop it, you can either clear the message entirely:</p>
<pre><code>    echo &gt; /sys/class/leds/onion\:amber\:system/message
</code></pre>
<p dir="auto">or change the LED trigger to something else:</p>
<pre><code>    echo default-on &gt; /sys/class/leds/onion\:amber\:system/trigger
</code></pre>
<p dir="auto">Feel free to try some of the other options as well!  Remember that you can view the available options by using "<em>cat</em>" as mentioned above.  (The "<em>heartbeat</em>" option is fun too.)</p>
<p dir="auto">There are many more settings status files available for other devices in /sys and it can be a great way to learn about working with hardware under Linux.</p>
]]></description><link>http://community.onion.io/post/2474</link><guid isPermaLink="true">http://community.onion.io/post/2474</guid><dc:creator><![CDATA[fader]]></dc:creator><pubDate>Sat, 19 Dec 2015 19:03:12 GMT</pubDate></item><item><title><![CDATA[Reply to Blinking Morse code on LED on Sat, 19 Dec 2015 22:01:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/320">@fader</a> This is a nice tutorial! Thanks for sharing. Do you mind if we put that on the wiki?</p>
]]></description><link>http://community.onion.io/post/2482</link><guid isPermaLink="true">http://community.onion.io/post/2482</guid><dc:creator><![CDATA[Boken Lin]]></dc:creator><pubDate>Sat, 19 Dec 2015 22:01:18 GMT</pubDate></item><item><title><![CDATA[Reply to Blinking Morse code on LED on Thu, 07 Jan 2016 17:58:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/5">@Boken-Lin</a> I don't mind at all; that would be fantastic! <img src="http://community.onion.io/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=ic093v0mjao" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" title=":)" alt="🙂" />  (Sorry, missed this message somehow.)</p>
]]></description><link>http://community.onion.io/post/3169</link><guid isPermaLink="true">http://community.onion.io/post/3169</guid><dc:creator><![CDATA[fader]]></dc:creator><pubDate>Thu, 07 Jan 2016 17:58:48 GMT</pubDate></item><item><title><![CDATA[Reply to Blinking Morse code on LED on Sun, 08 May 2016 00:04:33 GMT]]></title><description><![CDATA[<p dir="auto">Hi There -<br />
This is awesome! I have re-learned my morse, and am playing with my Onion Omega to get it to show morse on the led when triggered via IFTTT and the Onion Cloud! (and it's amazingly seamless to use the Onion Cloud)</p>
<p dir="auto">One thing I ran into when trying to update the "delay".  I kept getting a permission denied error when trying to write a new delay to the led with the command line specified. I also noted that the address used for the delay call in the example is different than that of the actual display call.   However, when I tried to set the delay with the same path as for the message, it appears to work.</p>
<p dir="auto">i.e. I used  "echo 100 &gt; /sys/class/leds/onion:amber:system/delay" and that seems to work.</p>
<p dir="auto">I don't know if I missed a step when trying to use the command above or not, but I wanted to post it in case anyone has encountered this as well.</p>
<p dir="auto">Thanks again for a very entertaining way to try out my Onion Omega and the Cloud!</p>
]]></description><link>http://community.onion.io/post/5423</link><guid isPermaLink="true">http://community.onion.io/post/5423</guid><dc:creator><![CDATA[Blair Hadfield]]></dc:creator><pubDate>Sun, 08 May 2016 00:04:33 GMT</pubDate></item><item><title><![CDATA[Reply to Blinking Morse code on LED on Mon, 09 May 2016 21:26:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/396">@Blair-Hadfield</a> That's awesome, really cool application of IFTTT &amp; the Omega!</p>
<p dir="auto">Regarding the delay issue:<br />
It looks like<br />
<code>/sys/class/leds/onion\:amber\:system/</code><br />
is actually a soft-link to<br />
<code>/sys/devices/platform/leds-gpio/leds/onion\:amber\:system/</code></p>
<p dir="auto">But I'm guessing that ubus likes using the <code>/sys/class/leds/onion\:amber\:system/</code> path more!<br />
Thanks for the heads-up!</p>
]]></description><link>http://community.onion.io/post/5453</link><guid isPermaLink="true">http://community.onion.io/post/5453</guid><dc:creator><![CDATA[Lazar Demin]]></dc:creator><pubDate>Mon, 09 May 2016 21:26:20 GMT</pubDate></item></channel></rss>