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: Star Trek 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,7 +79,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="title">Star Trek Example </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>This example shows how to use the <a class="el" href="classBlinkLED.html" title="Blink a LED on a digital output pin.">BlinkLED</a> and <a class="el" href="classChaseLEDs.html" title="Chase LED&#39;s on output pins in a defined sequence.">ChaseLEDs</a> classes to simulate the running lights on the starship Enterprise from Star Trek. This can be used as the basis for lighting a model kit. It is recommended that you read the <a class="el" href="blink_blink.html">Blink</a> and <a class="el" href="blink_cylon.html">Cylon</a> tutorials first.</p>
<div class="textblock"><p>This example shows how to use the <a class="el" href="classBlinkLED.html" title="Blink a LED on a digital output pin. ">BlinkLED</a> and <a class="el" href="classChaseLEDs.html" title="Chase LED&#39;s on output pins in a defined sequence. ">ChaseLEDs</a> classes to simulate the running lights on the starship Enterprise from Star Trek. This can be used as the basis for lighting a model kit. It is recommended that you read the <a class="el" href="blink_blink.html">Blink</a> and <a class="el" href="blink_cylon.html">Cylon</a> tutorials first.</p>
<p>There are four categories of lights on the Enterprise:</p>
<ul>
<li>Static lights in windows, engines, and the deflector dish. We don't handle those in this example as we assume that they are connected directly to the power supply with no computer control. </li>
@@ -99,18 +100,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="image">
<img src="StarTrekShield.png" alt="StarTrekShield.png"/>
</div>
<p>Now that we have a circuit, let's configure the red navigation LED on AOUT2 using the <a class="el" href="classBlinkLED.html" title="Blink a LED on a digital output pin.">BlinkLED</a> class, to blink with a period of 1000 milliseconds on, 1000 milliseconds off:</p>
<p>Now that we have a circuit, let's configure the red navigation LED on AOUT2 using the <a class="el" href="classBlinkLED.html" title="Blink a LED on a digital output pin. ">BlinkLED</a> class, to blink with a period of 1000 milliseconds on, 1000 milliseconds off:</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &lt;BlinkLED.h&gt;</span></div>
<div class="line"><span class="preprocessor">#define NAV_LIGHTS A2 // Output pin for controlling the navigation lights</span></div>
<div class="line"><span class="preprocessor">#define NAV_LIGHTS_ON 1000 // Time the navigation lights are on (milliseconds)</span></div>
<div class="line"><span class="preprocessor">#define NAV_LIGHTS_OFF 1000 // Time the navigation lights are off (milliseconds)</span></div>
<div class="line"><a class="code" href="classBlinkLED.html" title="Blink a LED on a digital output pin.">BlinkLED</a> navLights(NAV_LIGHTS, NAV_LIGHTS_ON, NAV_LIGHTS_OFF);</div>
<div class="line"><a class="code" href="classBlinkLED.html">BlinkLED</a> navLights(NAV_LIGHTS, NAV_LIGHTS_ON, NAV_LIGHTS_OFF);</div>
</div><!-- fragment --></p>
<p>We repeat the process for the strobe LED on AOUT3, with a period of 70 milliseconds on, and 830 milliseconds off:</p>
<div class="fragment"><div class="line"><span class="preprocessor">#define STROBE_LIGHT A3 // Output pin for controlling the strobe</span></div>
<div class="line"><span class="preprocessor">#define STROBE_LIGHT_ON 70 // Time the strobe light is on (milliseconds)</span></div>
<div class="line"><span class="preprocessor">#define STROBE_LIGHT_OFF 830 // Time the strobe light is off (milliseconds)</span></div>
<div class="line"><a class="code" href="classBlinkLED.html" title="Blink a LED on a digital output pin.">BlinkLED</a> strobeLight(STROBE_LIGHT, STROBE_LIGHT_ON, STROBE_LIGHT_OFF);</div>
<div class="line"><a class="code" href="classBlinkLED.html">BlinkLED</a> strobeLight(STROBE_LIGHT, STROBE_LIGHT_ON, STROBE_LIGHT_OFF);</div>
</div><!-- fragment --></p>
<p>We also need to arrange for <a class="el" href="classBlinkLED.html#aeeaf42b94c5392935f00f0f12a58c75e">BlinkLED::loop()</a> to be called from the application's main <code>loop()</code> function:</p>
<div class="fragment"><div class="line"><span class="keywordtype">void</span> loop() {</div>
@@ -118,7 +119,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"> strobeLight.loop();</div>
<div class="line">}</div>
</div><!-- fragment --><p>If you run the sketch at this point, you should see the navigation and strobe LED's blink with the selected rates.</p>
<p>Next is the twirl effect in the warp nacelles, using the <a class="el" href="classChaseLEDs.html" title="Chase LED&#39;s on output pins in a defined sequence.">ChaseLEDs</a> class. We are actually going to inherit from <a class="el" href="classChaseLEDs.html" title="Chase LED&#39;s on output pins in a defined sequence.">ChaseLEDs</a> to create a custom LED chaser that reads the chase rate from AIN0 and uses PWM outputs to create a trailing flame effect. See the <a class="el" href="blink_cylon.html">Cylon</a> example for more information on creating custom effects with <a class="el" href="classChaseLEDs.html" title="Chase LED&#39;s on output pins in a defined sequence.">ChaseLEDs</a>.</p>
<p>Next is the twirl effect in the warp nacelles, using the <a class="el" href="classChaseLEDs.html" title="Chase LED&#39;s on output pins in a defined sequence. ">ChaseLEDs</a> class. We are actually going to inherit from <a class="el" href="classChaseLEDs.html" title="Chase LED&#39;s on output pins in a defined sequence. ">ChaseLEDs</a> to create a custom LED chaser that reads the chase rate from AIN0 and uses PWM outputs to create a trailing flame effect. See the <a class="el" href="blink_cylon.html">Cylon</a> example for more information on creating custom effects with <a class="el" href="classChaseLEDs.html" title="Chase LED&#39;s on output pins in a defined sequence. ">ChaseLEDs</a>.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#define NACELLE_CHASE_LEN 6 // Length of nacelle chase, 1..6</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define NACELLE_MIN_PERIOD 25 // Minimum time to advance the nacelle chase (milliseconds)</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define NACELLE_MAX_PERIOD 250 // Maximum time to advance the nacelle chase (milliseconds)</span></div>
@@ -127,18 +128,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><span class="comment">// Output pins to use for the nacelle chase</span></div>
<div class="line">byte nacelleChasePins[6] = {3, 5, 6, 9, 10, 11};</div>
<div class="line"></div>
<div class="line"><span class="keyword">class </span>NacelleChaseLEDs : <span class="keyword">public</span> <a class="code" href="classChaseLEDs.html" title="Chase LED&#39;s on output pins in a defined sequence.">ChaseLEDs</a></div>
<div class="line"><span class="keyword">class </span>NacelleChaseLEDs : <span class="keyword">public</span> <a class="code" href="classChaseLEDs.html">ChaseLEDs</a></div>
<div class="line">{</div>
<div class="line"><span class="keyword">public</span>:</div>
<div class="line"> NacelleChaseLEDs(<span class="keyword">const</span> byte *pins, <span class="keywordtype">int</span> num)</div>
<div class="line"> : <a class="code" href="classChaseLEDs.html" title="Chase LED&#39;s on output pins in a defined sequence.">ChaseLEDs</a>(pins, num, 0) {}</div>
<div class="line"> : <a class="code" href="classChaseLEDs.html">ChaseLEDs</a>(pins, num, 0) {}</div>
<div class="line"></div>
<div class="line"><span class="keyword">protected</span>:</div>
<div class="line"> <span class="keywordtype">void</span> <a class="code" href="classChaseLEDs.html#aa0f4e0bd07dd65ee5574e894a612486b" title="Advances to the next LED in sequence, turning off prevPin, and turning on nextPin.">advance</a>(byte prevPin, byte nextPin) {</div>
<div class="line"> digitalWrite(<a class="code" href="classChaseLEDs.html#a27c460fcb341c2dc2fcf9341616eb525" title="Returns the pin that is n steps back in the sequence.">previousPin</a>(2), LOW);</div>
<div class="line"> <span class="keywordtype">void</span> <a class="code" href="classChaseLEDs.html#aa0f4e0bd07dd65ee5574e894a612486b">advance</a>(byte prevPin, byte nextPin) {</div>
<div class="line"> digitalWrite(<a class="code" href="classChaseLEDs.html#a27c460fcb341c2dc2fcf9341616eb525">previousPin</a>(2), LOW);</div>
<div class="line"> analogWrite(prevPin, NACELLE_DIM_VALUE);</div>
<div class="line"> digitalWrite(nextPin, HIGH);</div>
<div class="line"> <a class="code" href="classChaseLEDs.html#af560270f72302c19fb7f95002089c9d7" title="Sets the number of milliseconds to advance between LED&#39;s to advanceTime.">setAdvanceTime</a>(map(analogRead(NACELLE_RATE), 0, 1023, NACELLE_MIN_PERIOD, NACELLE_MAX_PERIOD));</div>
<div class="line"> <a class="code" href="classChaseLEDs.html#af560270f72302c19fb7f95002089c9d7">setAdvanceTime</a>(map(analogRead(NACELLE_RATE), 0, 1023, NACELLE_MIN_PERIOD, NACELLE_MAX_PERIOD));</div>
<div class="line"> }</div>
<div class="line">};</div>
<div class="line"></div>
@@ -198,28 +199,28 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
<div class="line"><span class="comment">// Output pins to use for the nacelle chase</span></div>
<div class="line">byte nacelleChasePins[6] = {3, 5, 6, 9, 10, 11};</div>
<div class="line"></div>
<div class="line"><span class="keyword">class </span>NacelleChaseLEDs : <span class="keyword">public</span> <a class="code" href="classChaseLEDs.html" title="Chase LED&#39;s on output pins in a defined sequence.">ChaseLEDs</a></div>
<div class="line"><span class="keyword">class </span>NacelleChaseLEDs : <span class="keyword">public</span> <a class="code" href="classChaseLEDs.html">ChaseLEDs</a></div>
<div class="line">{</div>
<div class="line"><span class="keyword">public</span>:</div>
<div class="line"> NacelleChaseLEDs(<span class="keyword">const</span> byte *pins, <span class="keywordtype">int</span> num)</div>
<div class="line"> : <a class="code" href="classChaseLEDs.html" title="Chase LED&#39;s on output pins in a defined sequence.">ChaseLEDs</a>(pins, num, 0) {}</div>
<div class="line"> : <a class="code" href="classChaseLEDs.html">ChaseLEDs</a>(pins, num, 0) {}</div>
<div class="line"></div>
<div class="line"><span class="keyword">protected</span>:</div>
<div class="line"> <span class="keywordtype">void</span> <a class="code" href="classChaseLEDs.html#aa0f4e0bd07dd65ee5574e894a612486b" title="Advances to the next LED in sequence, turning off prevPin, and turning on nextPin.">advance</a>(byte prevPin, byte nextPin) {</div>
<div class="line"> digitalWrite(<a class="code" href="classChaseLEDs.html#a27c460fcb341c2dc2fcf9341616eb525" title="Returns the pin that is n steps back in the sequence.">previousPin</a>(5), LOW);</div>
<div class="line"> analogWrite(<a class="code" href="classChaseLEDs.html#a27c460fcb341c2dc2fcf9341616eb525" title="Returns the pin that is n steps back in the sequence.">previousPin</a>(4), NACELLE_DIM_VALUE);</div>
<div class="line"> digitalWrite(<a class="code" href="classChaseLEDs.html#a27c460fcb341c2dc2fcf9341616eb525" title="Returns the pin that is n steps back in the sequence.">previousPin</a>(3), HIGH);</div>
<div class="line"> digitalWrite(<a class="code" href="classChaseLEDs.html#a27c460fcb341c2dc2fcf9341616eb525" title="Returns the pin that is n steps back in the sequence.">previousPin</a>(2), LOW);</div>
<div class="line"> <span class="keywordtype">void</span> <a class="code" href="classChaseLEDs.html#aa0f4e0bd07dd65ee5574e894a612486b">advance</a>(byte prevPin, byte nextPin) {</div>
<div class="line"> digitalWrite(<a class="code" href="classChaseLEDs.html#a27c460fcb341c2dc2fcf9341616eb525">previousPin</a>(5), LOW);</div>
<div class="line"> analogWrite(<a class="code" href="classChaseLEDs.html#a27c460fcb341c2dc2fcf9341616eb525">previousPin</a>(4), NACELLE_DIM_VALUE);</div>
<div class="line"> digitalWrite(<a class="code" href="classChaseLEDs.html#a27c460fcb341c2dc2fcf9341616eb525">previousPin</a>(3), HIGH);</div>
<div class="line"> digitalWrite(<a class="code" href="classChaseLEDs.html#a27c460fcb341c2dc2fcf9341616eb525">previousPin</a>(2), LOW);</div>
<div class="line"> analogWrite(prevPin, NACELLE_DIM_VALUE);</div>
<div class="line"> digitalWrite(nextPin, HIGH);</div>
<div class="line"> <a class="code" href="classChaseLEDs.html#af560270f72302c19fb7f95002089c9d7" title="Sets the number of milliseconds to advance between LED&#39;s to advanceTime.">setAdvanceTime</a>(map(analogRead(NACELLE_RATE), 0, 1023, NACELLE_MIN_PERIOD, NACELLE_MAX_PERIOD));</div>
<div class="line"> <a class="code" href="classChaseLEDs.html#af560270f72302c19fb7f95002089c9d7">setAdvanceTime</a>(map(analogRead(NACELLE_RATE), 0, 1023, NACELLE_MIN_PERIOD, NACELLE_MAX_PERIOD));</div>
<div class="line"> }</div>
<div class="line">};</div>
<div class="line"></div>
<div class="line">NacelleChaseLEDs nacelleChase(nacelleChasePins, NACELLE_CHASE_LEN);</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> navLights(NAV_LIGHTS, NAV_LIGHTS_ON, NAV_LIGHTS_OFF);</div>
<div class="line"><a class="code" href="classBlinkLED.html" title="Blink a LED on a digital output pin.">BlinkLED</a> strobeLight(STROBE_LIGHT, STROBE_LIGHT_ON, STROBE_LIGHT_OFF);</div>
<div class="line"><a class="code" href="classBlinkLED.html">BlinkLED</a> navLights(NAV_LIGHTS, NAV_LIGHTS_ON, NAV_LIGHTS_OFF);</div>
<div class="line"><a class="code" href="classBlinkLED.html">BlinkLED</a> strobeLight(STROBE_LIGHT, STROBE_LIGHT_ON, STROBE_LIGHT_OFF);</div>
<div class="line"></div>
<div class="line"><span class="keywordtype">void</span> setup() {</div>
<div class="line"> <span class="comment">// Turn off the status LED on the Arduino board (we don&#39;t need it).</span></div>
@@ -236,9 +237,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>