1
0
mirror of https://github.com/taigrr/arduinolibs synced 2025-01-18 04:33:12 -08:00

Update docs

This commit is contained in:
Rhys Weatherley
2015-03-12 19:03:15 +10:00
parent 083448f195
commit c6206e4216
493 changed files with 35310 additions and 3018 deletions

View File

@@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>ArduinoLibs: Blinking LED Example</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
@@ -29,7 +30,7 @@
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.2 -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
@@ -78,27 +79,27 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="title">Blinking LED Example </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>The <a class="el" href="classBlinkLED.html" title="Blink a LED on a digital output pin.">BlinkLED</a> class provides support logic for blinking a LED connected to an output pin. The traditional way to blink a LED uses a delay loop:</p>
<div class="textblock"><p>The <a class="el" href="classBlinkLED.html" title="Blink a LED on a digital output pin. ">BlinkLED</a> class provides support logic for blinking a LED connected to an output pin. The traditional way to blink a LED uses a delay loop:</p>
<div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
<div class="line"> digitalWrite(13, HIGH);</div>
<div class="line"> delay(1000);</div>
<div class="line"> digitalWrite(13, LOW);</div>
<div class="line"> delay(1000);</div>
<div class="line">}</div>
</div><!-- fragment --><p>The problem with this code is that the entire application is blocked during the <code>delay()</code>. No other activities can be serviced. <a class="el" href="classBlinkLED.html" title="Blink a LED on a digital output pin.">BlinkLED</a> provides a re-entrant timer-based implementation that is simple to use in any application and which won't block other activities.</p>
<p>We start this example by including the <a class="el" href="classBlinkLED.html" title="Blink a LED on a digital output pin.">BlinkLED</a> class and instantiating an object instance:</p>
</div><!-- fragment --><p>The problem with this code is that the entire application is blocked during the <code>delay()</code>. No other activities can be serviced. <a class="el" href="classBlinkLED.html" title="Blink a LED on a digital output pin. ">BlinkLED</a> provides a re-entrant timer-based implementation that is simple to use in any application and which won't block other activities.</p>
<p>We start this example by including the <a class="el" href="classBlinkLED.html" title="Blink a LED on a digital output pin. ">BlinkLED</a> class and instantiating an object instance:</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &lt;BlinkLED.h&gt;</span></div>
<div class="line"></div>
<div class="line"><a class="code" href="classBlinkLED.html" title="Blink a LED on a digital output pin.">BlinkLED</a> statusBlink(13, 70, 930);</div>
<div class="line"><a class="code" href="classBlinkLED.html">BlinkLED</a> statusBlink(13, 70, 930);</div>
</div><!-- fragment --></p>
<p>In this example we have specified that the LED is on pin D13, the LED should be on for 70 milliseconds, and off for 930 milliseconds. This will cause the status LED to "strobe" once per second. The LED will be initially off for 930 milliseconds after device reset. To start with the LED on, use the following initialization code instead:</p>
<div class="fragment"><div class="line"><a class="code" href="classBlinkLED.html" title="Blink a LED on a digital output pin.">BlinkLED</a> statusBlink(13, 70, 930, <span class="keyword">true</span>);</div>
<div class="fragment"><div class="line"><a class="code" href="classBlinkLED.html">BlinkLED</a> statusBlink(13, 70, 930, <span class="keyword">true</span>);</div>
</div><!-- fragment --><p>The remaining code we need is a call to <a class="el" href="classBlinkLED.html#aeeaf42b94c5392935f00f0f12a58c75e">BlinkLED::loop()</a> every time around the main application loop:</p>
<div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
<div class="line"> statusBlink.loop();</div>
<div class="line">}</div>
</div><!-- fragment --></p>
<p>As can be seen, <a class="el" href="classBlinkLED.html" title="Blink a LED on a digital output pin.">BlinkLED</a> simplifies the process of blinking a LED quite considerably. It is also possible to <a class="el" href="classBlinkLED.html#a2760a0223cd6a0598b961f681ffb5c0a">pause()</a> and <a class="el" href="classBlinkLED.html#a380241e4dfd20e8a558487227f2f4252">resume()</a> the blinking. This is useful in applications where a blinking LED indicates a certain state such as an error condition or a long-running operation that is in progress; with the LED off at other times. The on/off blink rate can be modified at runtime using <a class="el" href="classBlinkLED.html#a47f95624881063aa91c0066ed2c92258" title="Sets the onTime and offTime (in milliseconds).">BlinkLED::setBlinkRate()</a>, and the LED can be set to a specific value using <a class="el" href="classBlinkLED.html#af904a345e56d49948a042ac439d0b9d4" title="Sets the current state of the LED, where true is on, false is off.">BlinkLED::setState()</a>.</p>
<p>As can be seen, <a class="el" href="classBlinkLED.html" title="Blink a LED on a digital output pin. ">BlinkLED</a> simplifies the process of blinking a LED quite considerably. It is also possible to <a class="el" href="classBlinkLED.html#a2760a0223cd6a0598b961f681ffb5c0a">pause()</a> and <a class="el" href="classBlinkLED.html#a380241e4dfd20e8a558487227f2f4252">resume()</a> the blinking. This is useful in applications where a blinking LED indicates a certain state such as an error condition or a long-running operation that is in progress; with the LED off at other times. The on/off blink rate can be modified at runtime using <a class="el" href="classBlinkLED.html#a47f95624881063aa91c0066ed2c92258" title="Sets the onTime and offTime (in milliseconds). ">BlinkLED::setBlinkRate()</a>, and the LED can be set to a specific value using <a class="el" href="classBlinkLED.html#af904a345e56d49948a042ac439d0b9d4" title="Sets the current state of the LED, where true is on, false is off. ">BlinkLED::setState()</a>.</p>
<p>The full source code for the example follows:</p>
<div class="fragment"><div class="line"><span class="comment">/*</span></div>
<div class="line"><span class="comment">Blink the status LED using the BlinkLED utility class.</span></div>
@@ -108,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"></div>
<div class="line"><span class="preprocessor">#include &lt;BlinkLED.h&gt;</span></div>
<div class="line"></div>
<div class="line"><a class="code" href="classBlinkLED.html" title="Blink a LED on a digital output pin.">BlinkLED</a> statusBlink(13, 70, 930);</div>
<div class="line"><a class="code" href="classBlinkLED.html">BlinkLED</a> statusBlink(13, 70, 930);</div>
<div class="line"></div>
<div class="line"><span class="keywordtype">void</span> setup() {}</div>
<div class="line"></div>
@@ -119,9 +120,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
</div><!-- fragment --> </div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Sep 29 2013 09:30:46 for ArduinoLibs by &#160;<a href="http://www.doxygen.org/index.html">
Generated on Thu Mar 12 2015 19:02:05 for ArduinoLibs by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.2
</a> 1.8.6
</small></address>
</body>
</html>