<?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[fast-gpio pulses syntax from onion cloud (ubus syntax)]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I have been trying to use the <em>fast-gpio</em> utility with the <em>pulses</em> option from onion cloud without success. I can make it work with the <em>read</em> option, which only takes a single parameter after the <em>read</em>, but the <em>pulses</em> needs 3 parameters. Does anybody now the syntax for it?</p>
<p dir="auto">Thank you,</p>
<p dir="auto">Ricardo.</p>
]]></description><link>http://community.onion.io/topic/2455/fast-gpio-pulses-syntax-from-onion-cloud-ubus-syntax</link><generator>RSS for Node</generator><lastBuildDate>Mon, 14 Sep 2026 05:15:21 GMT</lastBuildDate><atom:link href="http://community.onion.io/topic/2455.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 27 Oct 2017 06:10:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to fast-gpio pulses syntax from onion cloud (ubus syntax) on Fri, 27 Oct 2017 06:10:50 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I have been trying to use the <em>fast-gpio</em> utility with the <em>pulses</em> option from onion cloud without success. I can make it work with the <em>read</em> option, which only takes a single parameter after the <em>read</em>, but the <em>pulses</em> needs 3 parameters. Does anybody now the syntax for it?</p>
<p dir="auto">Thank you,</p>
<p dir="auto">Ricardo.</p>
]]></description><link>http://community.onion.io/post/14884</link><guid isPermaLink="true">http://community.onion.io/post/14884</guid><dc:creator><![CDATA[Ricardo Cassia]]></dc:creator><pubDate>Fri, 27 Oct 2017 06:10:50 GMT</pubDate></item><item><title><![CDATA[Reply to fast-gpio pulses syntax from onion cloud (ubus syntax) on Fri, 27 Oct 2017 08:25:42 GMT]]></title><description><![CDATA[<p dir="auto">The utility you're refering to is open-source at <a href="https://github.com/OnionIoT/fast-gpio/blob/master/src/main.cpp" rel="nofollow">https://github.com/OnionIoT/fast-gpio/blob/master/src/main.cpp</a>. You can see  that the <code>pulses</code> option's help text is <code>pulses &lt;gpio&gt; &lt;path_pulses_file&gt; &lt;repeats&gt;</code> When given this option, the program will call the function <code>pulseGpio(FastGpio *gpioObj,int pinNum, char* pathToFile, int repeats)</code> <a href="https://github.com/OnionIoT/fast-gpio/blob/master/src/main.cpp#L285" rel="nofollow">here</a>, which reads from the given file line-wise in the format <code>%d,%d</code> the times the pin is supposed to go up and down. This info is then given to <code>void pulse(FastGpio *gpioObj,int pinNum,int highMicros, int lowMicros)</code> in <a href="https://github.com/OnionIoT/fast-gpio/blob/master/src/main.cpp#L276" rel="nofollow">this function</a>.</p>
<p dir="auto">In summary: Create a text file <code>pulses.txt</code> with the content</p>
<pre><code>100,20
10,2000
50,10
</code></pre>
<p dir="auto">Run it with <code>pulses 9 pulses.txt 3</code></p>
<p dir="auto">It  will then take GPIO 9, goes through each line and sets GPIO9 high for 100 microseconds, then low for 20 microseconds, then high for 10 microseconds, then low for 2000 microseconds, then high for 50 microseconds, then low for 10 microseconds, then repeat the whole thing 2 more times (<code>repeat=3</code>).</p>
]]></description><link>http://community.onion.io/post/14886</link><guid isPermaLink="true">http://community.onion.io/post/14886</guid><dc:creator><![CDATA[Maximilian Gerhardt]]></dc:creator><pubDate>Fri, 27 Oct 2017 08:25:42 GMT</pubDate></item><item><title><![CDATA[Reply to fast-gpio pulses syntax from onion cloud (ubus syntax) on Fri, 27 Oct 2017 16:06:41 GMT]]></title><description><![CDATA[<p dir="auto">Thank you very much for your explanation. However, I have been successfully running the utility in its normal use case, which is from the command line in a shell. This works just fine:</p>
<blockquote>
<p dir="auto">root@Omega:~# fast-gpio pulses 19 /root/input.csv 3<br />
Pulses GPIO19: r)wr)w,</p>
</blockquote>
<p dir="auto">Now, I would like to run it <strong>from the Onion Cloud</strong>. Since one of methods to do it, is to use the <em>ubus</em> format, for debugging purposes, I ran ubus locally in the CLI, and I could get the <em>read</em> option to work:</p>
<blockquote>
<p dir="auto">root@Omega:/# ubus call onion fast-gpio '{"params":{"read":"19"}}'<br />
{<br />
"cmd": "Read",<br />
"pin": 19,<br />
"val": "0"<br />
}</p>
</blockquote>
<p dir="auto">However, I can't get the syntax of the <em>pulses</em> option right. I tried the following:</p>
<blockquote>
<p dir="auto">root@Omega:/# ubus call onion fast-gpio '{"params":{"pulses":{"19","/root/input.csv","3"}}}'<br />
Failed to parse message data</p>
</blockquote>
<blockquote>
<p dir="auto">root@Omega:/# ubus call onion fast-gpio '{"params":{"pulses":{"19" "/root/input.csv" "3"}}}'<br />
Failed to parse message data</p>
</blockquote>
<blockquote>
<p dir="auto">root@Omega:/# ubus call onion fast-gpio '{"params":{"pulses":"19","/root/input.csv","3"}}'<br />
Failed to parse message data</p>
</blockquote>
<blockquote>
<p dir="auto">root@Omega:/# ubus call onion fast-gpio '{"params":{"pulses":"19 /root/input.csv 3"}}'<br />
Command failed: Invalid argument</p>
</blockquote>
<blockquote>
<p dir="auto">root@Omega:/# ubus call onion fast-gpio '{"params":{"pulses":"19,/root/input.csv,3"}}'<br />
Command failed: Invalid argument</p>
</blockquote>
<p dir="auto">Do you know how the syntax for the <em>ubus</em> looks like for the <em>pulses</em> option?</p>
<p dir="auto">Thank you!</p>
]]></description><link>http://community.onion.io/post/14890</link><guid isPermaLink="true">http://community.onion.io/post/14890</guid><dc:creator><![CDATA[Ricardo Cassia]]></dc:creator><pubDate>Fri, 27 Oct 2017 16:06:41 GMT</pubDate></item><item><title><![CDATA[Reply to fast-gpio pulses syntax from onion cloud (ubus syntax) on Fri, 27 Oct 2017 17:54:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/4758">@Ricardo-Cassia</a> : Oh okay, it wasn't clear to me that you were already using it correctly from the commandline.</p>
<p dir="auto">However, same thing applies here: The relevant ubus call is happening here: <a href="https://github.com/OnionIoT/onion-ubus/blob/master/onion-ubus.sh#L275" rel="nofollow">https://github.com/OnionIoT/onion-ubus/blob/master/onion-ubus.sh#L275</a>. This is where it reads the parameters from the JSON thing. If you can figure out what the <code>_ParseArgumentsObject</code> functions parses exactly (located at <code>/usr/lib/onion/lib.sh</code>), you can figure out what JSON to give it so that the command string is created correctly.</p>
<p dir="auto">Edit: I've hacked my way around the parsing functions and atleast got the "set" to work right: <code>ubus call onion fast-gpio '{"params":{"set":"8","1":""}}'</code>. Ut just concatinates the keys and values of the JSON object together. However - if the key is empty, it is replaced by "-". The value can be empty however. Thus I can create the command string <code>fast-gpio -u set 8 1</code> using this trick.. Characters like "/" and "." are replaced by "_" when they're the key string. Unfortunetly, these tricks doesn't seem to quite work for pulses. <code>ubus call onion fast-gpio '{"params":{"pulses":"8","wave":"","1":""}}'</code> just throws "invalid argument"..</p>
]]></description><link>http://community.onion.io/post/14891</link><guid isPermaLink="true">http://community.onion.io/post/14891</guid><dc:creator><![CDATA[Maximilian Gerhardt]]></dc:creator><pubDate>Fri, 27 Oct 2017 17:54:15 GMT</pubDate></item><item><title><![CDATA[Reply to fast-gpio pulses syntax from onion cloud (ubus syntax) on Sun, 29 Oct 2017 01:36:15 GMT]]></title><description><![CDATA[<p dir="auto">Maximilian, thank you very much for your help.</p>
<p dir="auto">I experimented a little more and also concluded that the method doesn't work for the pulses option. However, I did find a work around.</p>
<p dir="auto">Instead of using the fast-gpio access through the ubus call (which would allow me access from anywhere), I created a 1-liner script that looks like this:</p>
<blockquote>
<p dir="auto">fast-gpio pulses 19 $1 3</p>
</blockquote>
<p dir="auto">and named it <em>/root/gpio19</em></p>
<p dir="auto">Going back to the <strong>Onion Cloud</strong>, I chose the method <em>launch-process</em>, and as the command I set:</p>
<blockquote>
<p dir="auto">/root/gpio19 /root/input.csv</p>
</blockquote>
<p dir="auto">The response is:</p>
<blockquote>
<p dir="auto">{<br />
"resp": "Command to launch in background: /root/gpio19 /root/1.on.csv"<br />
}</p>
</blockquote>
<p dir="auto">and it actually does what was supposed to!</p>
<p dir="auto">By the way, I'm using this to create a middle man between the Internet and my RF controlled outlets. I can now develop apps or crontabs to turn things on and off through the house.</p>
]]></description><link>http://community.onion.io/post/14899</link><guid isPermaLink="true">http://community.onion.io/post/14899</guid><dc:creator><![CDATA[Ricardo Cassia]]></dc:creator><pubDate>Sun, 29 Oct 2017 01:36:15 GMT</pubDate></item></channel></rss>