<?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>Simple Threading and Serial User Interface library for the Arduino</title><link>/products/arduino/b/blog/posts/simple-threading-and-serial-user-interface-library-for-the-arduino</link><description>One of my first big micro-controller projects was called the Neonatal Closed Loop Oxygen System. When babies are born prematurely, they have to be fed very specific amounts of oxygen. Too little oxygen and they suffocate, too much oxygen and they can</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Simple Threading and Serial User Interface library for the Arduino</title><link>https://community.element14.com/products/arduino/b/blog/posts/simple-threading-and-serial-user-interface-library-for-the-arduino</link><pubDate>Wed, 20 Aug 2014 12:54:03 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:80eb1687-6283-417d-9013-4561723f8c4d</guid><dc:creator>e14 Contributor</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Dear Members as I read your blogs I am daily thankful and amazed.&lt;/p&gt;&lt;p&gt;What a gift to be able to create, make, fix.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thankyou to all,&lt;/p&gt;&lt;p&gt;Laureen&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=17487&amp;AppID=145&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Simple Threading and Serial User Interface library for the Arduino</title><link>https://community.element14.com/products/arduino/b/blog/posts/simple-threading-and-serial-user-interface-library-for-the-arduino</link><pubDate>Wed, 14 May 2014 15:57:36 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:80eb1687-6283-417d-9013-4561723f8c4d</guid><dc:creator>Robert Peter Oakes</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;you put the scanning of the IO (Analog or Digital) into the interrupt routine and have it coded very efficiently so no maths or other interpretation of the results, just raw input&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;then the main routine that can be interrupted without affect can simply monitor the variables managed by the IO interrupt to make decisions and perform maths functions to its hearts content&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;A semaphore system could be used to notify the routines when critical calculations are under-way to inhibit the interrupt from changing values part way through use. Or use a double buffer where the interrupt updates only one buffer and the main routine disables interrupts only long enough to copy the buffer. This would eliminate the race hazard altogether&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=17487&amp;AppID=145&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Simple Threading and Serial User Interface library for the Arduino</title><link>https://community.element14.com/products/arduino/b/blog/posts/simple-threading-and-serial-user-interface-library-for-the-arduino</link><pubDate>Wed, 14 May 2014 12:11:21 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:80eb1687-6283-417d-9013-4561723f8c4d</guid><dc:creator>Workshopshed</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Hi Garrett,&lt;/p&gt;&lt;p&gt;I do have a project where it has multiple tasks to do, read RTC, move steppers, respond to serial input. However, I was planning to approach the problem by ensuring that none of the actions were blocking (or at least not for any significant duration). I don&amp;#39;t have any long calculations so I&amp;#39;m not sure that these threading libraries will help.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;For your monitor approach I&amp;#39;d be tempted to use a timer interupt to handle the setting of the output values as that is the critical item. For the alarm you could store the time value when you start the alarm and then periodically check to see if the right period has elapsed to turn it back off again, that does not need to be a blocking operation. I&amp;#39;d make sure that the LCD was an I2C one to avoid having to do too much processing on the microcontroller.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a class="jive-link-external-small" href="http://letsmakerobots.com/content/arduino-101-timers-and-interrupts" rel="nofollow ugc noopener" target="_blank" title="http://letsmakerobots.com/content/arduino-101-timers-and-interrupts"&gt;Arduino 101: Timers and Interrupts | Let&amp;#39;s Make Robots!&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;For your long calculation how do you ensure that the calculation does not block? It would seem all the examples use &lt;span class="n"&gt;PT_WAIT_MS to have co-operative multi-tasking so do you split your calculations into steps and call PT_WAIT_MS inbetween?&lt;/span&gt;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=17487&amp;AppID=145&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Simple Threading and Serial User Interface library for the Arduino</title><link>https://community.element14.com/products/arduino/b/blog/posts/simple-threading-and-serial-user-interface-library-for-the-arduino</link><pubDate>Wed, 16 Apr 2014 19:28:18 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:80eb1687-6283-417d-9013-4561723f8c4d</guid><dc:creator>e14 Contributor</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Post has been updated to reflect the most recent revision. Functions and Variables now take up 0 bytes of SRAM, and threads only take up 4!&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=17487&amp;AppID=145&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>