<?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[GPIO and Python?]]></title><description><![CDATA[<p dir="auto">Hi everyone. I just got my Onion Omega a couple of days ago. I'm a hardware person, but I've been away from software for a while. I'm learning Python, but I'd like to be able to control the GPIO pins directly from my Python code. Is that possible now? If not, is it coming soon?</p>
]]></description><link>http://community.onion.io/topic/502/gpio-and-python</link><generator>RSS for Node</generator><lastBuildDate>Thu, 21 May 2026 01:26:44 GMT</lastBuildDate><atom:link href="http://community.onion.io/topic/502.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 03 Feb 2016 02:53:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to GPIO and Python? on Wed, 03 Feb 2016 02:53:10 GMT]]></title><description><![CDATA[<p dir="auto">Hi everyone. I just got my Onion Omega a couple of days ago. I'm a hardware person, but I've been away from software for a while. I'm learning Python, but I'd like to be able to control the GPIO pins directly from my Python code. Is that possible now? If not, is it coming soon?</p>
]]></description><link>http://community.onion.io/post/3852</link><guid isPermaLink="true">http://community.onion.io/post/3852</guid><dc:creator><![CDATA[Brian Piersel]]></dc:creator><pubDate>Wed, 03 Feb 2016 02:53:10 GMT</pubDate></item><item><title><![CDATA[Reply to GPIO and Python? on Wed, 03 Feb 2016 04:20:09 GMT]]></title><description><![CDATA[<p dir="auto">Im not the offical word, But In my logic The onion omega runs linux,  What else runs linux a rasberry pi, a rasberry pi also has gpio's and a Python library.</p>
<p dir="auto">So based off of that logic I would have to guess that that python library would work. I could be 100% wrong and that library could be pi specific.</p>
<p dir="auto">The only way to know is to try. Give it a shot and let us know. <a href="https://pypi.python.org/pypi/RPi.GPIO" rel="nofollow">https://pypi.python.org/pypi/RPi.GPIO</a></p>
]]></description><link>http://community.onion.io/post/3855</link><guid isPermaLink="true">http://community.onion.io/post/3855</guid><dc:creator><![CDATA[Chris McCaslin]]></dc:creator><pubDate>Wed, 03 Feb 2016 04:20:09 GMT</pubDate></item><item><title><![CDATA[Reply to GPIO and Python? on Wed, 03 Feb 2016 23:49:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/1084">@chris-mccaslin</a> Thanks for the suggestion. I wasn't able to install that library, but that may be because I'm not familiar enough with Linux to understand what it needs. <img src="http://community.onion.io/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=ic093v0mjao" class="not-responsive emoji emoji-android emoji--wink" title=";-)" alt="😉" /> I did figure out how to access the ports through the filesystem (/sys/class/gpio). If nothing else gets posted before I get my code packaged nicely, I'll post it for others.</p>
]]></description><link>http://community.onion.io/post/3864</link><guid isPermaLink="true">http://community.onion.io/post/3864</guid><dc:creator><![CDATA[Brian Piersel]]></dc:creator><pubDate>Wed, 03 Feb 2016 23:49:06 GMT</pubDate></item><item><title><![CDATA[Reply to GPIO and Python? on Fri, 05 Feb 2016 02:42:52 GMT]]></title><description><![CDATA[<p dir="auto">I've posted some simple code at <a href="https://github.com/BravoPapa/OmegaGPIO" rel="nofollow">https://github.com/BravoPapa/OmegaGPIO</a> on GitHub.</p>
]]></description><link>http://community.onion.io/post/3905</link><guid isPermaLink="true">http://community.onion.io/post/3905</guid><dc:creator><![CDATA[Brian Piersel]]></dc:creator><pubDate>Fri, 05 Feb 2016 02:42:52 GMT</pubDate></item><item><title><![CDATA[Reply to GPIO and Python? on Fri, 05 Feb 2016 15:55:47 GMT]]></title><description><![CDATA[<p dir="auto">Is it possible to use Interrups (Falling;Rising;Change) like I know it from Arduino?<br />
I would like to read a rotery-encoder with my <a href="http://onion.io" rel="nofollow">onion.io</a></p>
<p dir="auto">Thanks in advance.</p>
]]></description><link>http://community.onion.io/post/3931</link><guid isPermaLink="true">http://community.onion.io/post/3931</guid><dc:creator><![CDATA[Uwe Stahl209]]></dc:creator><pubDate>Fri, 05 Feb 2016 15:55:47 GMT</pubDate></item><item><title><![CDATA[Reply to GPIO and Python? on Fri, 05 Feb 2016 21:38:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/1105">@Uwe-Stahl209</a> While I know little about Python, I have written some C++ code that provides a library and access program for GPIO control in general - this includes code for catching and acting on interrupts.  In case it is of any use for you, while I have posted information on it in this community, the information can best be found at <a href="https://github.com/KitBishop/new-gpio" rel="nofollow">https://github.com/KitBishop/new-gpio</a> - see the documentation in the PDF file there - new-gpio.pdf</p>
]]></description><link>http://community.onion.io/post/3938</link><guid isPermaLink="true">http://community.onion.io/post/3938</guid><dc:creator><![CDATA[Kit Bishop]]></dc:creator><pubDate>Fri, 05 Feb 2016 21:38:53 GMT</pubDate></item><item><title><![CDATA[Reply to GPIO and Python? on Sat, 06 Feb 2016 21:42:31 GMT]]></title><description><![CDATA[<p dir="auto">Yes, this I know, but a Python library would be nice as well <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="🙂" /></p>
<p dir="auto">A general question: On AVR devices you have "real"  interrupts in the sense that special pins provide this functionality.<br />
Is is possible on Omega as well? Or is you code just looking for pin-change with the ordinary read functionality of the pin status?</p>
<p dir="auto">Yours</p>
<p dir="auto">Uwe</p>
]]></description><link>http://community.onion.io/post/3949</link><guid isPermaLink="true">http://community.onion.io/post/3949</guid><dc:creator><![CDATA[Uwe Stahl209]]></dc:creator><pubDate>Sat, 06 Feb 2016 21:42:31 GMT</pubDate></item><item><title><![CDATA[Reply to GPIO and Python? on Sat, 06 Feb 2016 21:55:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/1105">@Uwe-Stahl209</a> I'm too new to Python and the Omega to add interrupts to my code. I'm not sure that Python can handle interrupts directly, but I could be wrong.</p>
]]></description><link>http://community.onion.io/post/3950</link><guid isPermaLink="true">http://community.onion.io/post/3950</guid><dc:creator><![CDATA[Brian Piersel]]></dc:creator><pubDate>Sat, 06 Feb 2016 21:55:23 GMT</pubDate></item><item><title><![CDATA[Reply to GPIO and Python? on Sat, 06 Feb 2016 22:33:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/1105">@Uwe-Stahl209</a> The code I referenced above does use <em><strong>"real" interrupts</strong></em> via the use of the Omega library <strong>gpio-irq</strong> and usage of the <strong>/sys/kernel/debug/gpio-irq</strong> system file system.</p>
<p dir="auto">As I said I don't know much about Python and what facilities it provides in connection with interrupts.  My guess is that some sort of wrapper code would be needed to provide such functionality (as I am doing and have largely working for Java).</p>
<p dir="auto">Also, while I don't know what you want to do with the interrupts in Python - i.e. to be able to respond to interrupts within Python code or to just run some Python code when a pin change occurs I would draw you attention to the capability of the <strong>new-gpio</strong> program to run <em><strong>ANY</strong></em> command in response to an interrupt on a pin. Just use a command like:</p>
<ul>
<li><strong>new-gpio irq &lt;pin-number&gt; &lt;irq-type&gt; "&lt;command" &lt;optional-debounce&gt;</strong><br />
Where:
<ul>
<li><strong>&lt;pin-number&gt;</strong> is the relevant pin</li>
<li><strong>&lt;irq-type&gt;</strong> is one of <strong>rising</strong> or <strong>falling</strong> or <strong>both</strong> - depending upon what pin level change you want to trigger the interrupt</li>
<li><strong>&lt;command&gt;</strong> is the command to be executed when the interrupt occurs.  So long as you have not stopped interrupt handling on the pin by using the <strong>irqstop</strong> command to <strong>new-gpio</strong> for the pin this command will be executed each and every time the interrupt occurs (i.e. the pin undergoes the relevant change)</li>
<li><strong>&lt;optional-debounce&gt;</strong> is a delay time in milliseconds to allow for debounce handling on noisy switches</li>
</ul>
</li>
</ul>
<p dir="auto">More information can be found in the documentation in <strong>new-gpio.pdf</strong> file I supplied.</p>
]]></description><link>http://community.onion.io/post/3951</link><guid isPermaLink="true">http://community.onion.io/post/3951</guid><dc:creator><![CDATA[Kit Bishop]]></dc:creator><pubDate>Sat, 06 Feb 2016 22:33:16 GMT</pubDate></item><item><title><![CDATA[Reply to GPIO and Python? on Sun, 07 Feb 2016 22:49:56 GMT]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">I want to read a Rotary-Encoder and do some other stuff like sending data via serial output.On Arduino this is normally made with an interrupt pin.<br />
So I don't get it: Can I use your library in Python? Or could I use your program to run a small Python script that somehow sends the rotary-value to my main Pythons script where all the rest is done?</p>
<p dir="auto">Thanks,</p>
<p dir="auto">Uwe</p>
]]></description><link>http://community.onion.io/post/3957</link><guid isPermaLink="true">http://community.onion.io/post/3957</guid><dc:creator><![CDATA[Uwe Stahl209]]></dc:creator><pubDate>Sun, 07 Feb 2016 22:49:56 GMT</pubDate></item><item><title><![CDATA[Reply to GPIO and Python? on Mon, 08 Feb 2016 05:12:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/1105">@Uwe-Stahl209</a> A few more comments that may assist you:</p>
<ol>
<li>
<p dir="auto">On the Omega, all GPIO pins are capable of generating interrupts, unlike on the Arduino where there is a limited number of pins that can generate interrupts</p>
</li>
<li>
<p dir="auto">Interrupt handling is done on the hardware level and needs C/C++ to handle it.  On the Arduino, all code is written in C/C++ and functions are provided that enable you to catch and react to the interrupts.  My <strong>libnew-gpio</strong> code provides similar C/C++ functionality for interrupt handling.</p>
</li>
<li>
<p dir="auto">To handle interrupts in any other language (e.g. Python) requires the ability for that language to call the relevant C/C++ (e.g. via wrapper functions) to gain that functionality.  I know how to do this for Java (and have done so) but I do not know how to do this for Python - perhaps someone else does.</p>
</li>
<li>
<p dir="auto">While as I have said, I don't know much about Python, if, as your message suggests, one Python script can send a message to another Python script, then your suggestion may work.  Lets say you have two Python scripts:</p>
<ul>
<li><strong>python-a</strong> that reads you rotary encoder values and sends a message to <strong>python-b</strong> indicating that the encoder value has changed</li>
<li><strong>python-b</strong> that can handle messages from <strong>python-a</strong></li>
</ul>
</li>
</ol>
<p dir="auto">Then something like the following might work:</p>
<ul>
<li><strong>new-gpio irq &lt;pin-number&gt; &lt;irq-type&gt; "command to run python-a" &lt;debounce-if-required&gt;</strong><br />
<strong>run python-b</strong></li>
</ul>
]]></description><link>http://community.onion.io/post/3963</link><guid isPermaLink="true">http://community.onion.io/post/3963</guid><dc:creator><![CDATA[Kit Bishop]]></dc:creator><pubDate>Mon, 08 Feb 2016 05:12:08 GMT</pubDate></item><item><title><![CDATA[Reply to GPIO and Python? on Wed, 24 Feb 2016 00:45:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/1057">@Brian-Piersel</a> Thanks for the simple-to-use code! I've written a simple Python script that imports your omega_gpio script and controls three of four relays on a relay module to light various combinations of RGB LEDs on a light strip (the script is fairly well documented, so further description is probably not necessary here):</p>
<p dir="auto"><a href="/uploads/files/1456274483471-colors.py">colors.py</a></p>
]]></description><link>http://community.onion.io/post/4192</link><guid isPermaLink="true">http://community.onion.io/post/4192</guid><dc:creator><![CDATA[Jeff Verive]]></dc:creator><pubDate>Wed, 24 Feb 2016 00:45:02 GMT</pubDate></item></channel></rss>