library/Doku/Doxygen/html/d8/d7a/group__lowerlevelfun.html

157 lines
12 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<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.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Arduino {code}racer API: Lower level fun stuff methods</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="../../coderace_logo.JPG"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Arduino {code}racer API
</div>
<div id="projectbrief">... better know the details.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('d8/d7a/group__lowerlevelfun.html','../../');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">Lower level fun stuff methods</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga04309a38252639a8eaa43809c04c11c8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d8/d7a/group__lowerlevelfun.html#ga04309a38252639a8eaa43809c04c11c8">CodeRacer::look_around</a> ()</td></tr>
<tr class="memdesc:ga04309a38252639a8eaa43809c04c11c8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fun stuff - will move the servo around after a random amount of time. <a href="#ga04309a38252639a8eaa43809c04c11c8">More...</a><br /></td></tr>
<tr class="separator:ga04309a38252639a8eaa43809c04c11c8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3b6f819fb82d910888fbc87abff1470c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d8/d7a/group__lowerlevelfun.html#ga3b6f819fb82d910888fbc87abff1470c">CodeRacer::kitt</a> ()</td></tr>
<tr class="memdesc:ga3b6f819fb82d910888fbc87abff1470c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fun stuff - you know Knightrider... <a href="#ga3b6f819fb82d910888fbc87abff1470c">More...</a><br /></td></tr>
<tr class="separator:ga3b6f819fb82d910888fbc87abff1470c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga04309a38252639a8eaa43809c04c11c8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga04309a38252639a8eaa43809c04c11c8">&#9670;&nbsp;</a></span>look_around()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void CodeRacer::look_around </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Fun stuff - will move the servo around after a random amount of time. </p>
<dl class="section return"><dt>Returns</dt><dd>nothing </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d4/da7/_code_racer_8cpp_source.html#l00440">440</a> of file <a class="el" href="../../d4/da7/_code_racer_8cpp_source.html">CodeRacer.cpp</a>.</p>
<div class="fragment"><div class="line"><a name="l00441"></a><span class="lineno"> 441</span>&#160;{</div><div class="line"><a name="l00442"></a><span class="lineno"> 442</span>&#160; <span class="keywordflow">if</span> (_servo_look_around_at_ms &lt; millis()) {</div><div class="line"><a name="l00443"></a><span class="lineno"> 443</span>&#160; _servo_look_around_at_ms = millis() + random(FUN_MIN_PAUSE_MS, FUN_MAX_PAUSE_MS);</div><div class="line"><a name="l00444"></a><span class="lineno"> 444</span>&#160; servo_set_to_left();</div><div class="line"><a name="l00445"></a><span class="lineno"> 445</span>&#160; delay(500);</div><div class="line"><a name="l00446"></a><span class="lineno"> 446</span>&#160; servo_set_to_right();</div><div class="line"><a name="l00447"></a><span class="lineno"> 447</span>&#160; delay(800);</div><div class="line"><a name="l00448"></a><span class="lineno"> 448</span>&#160; servo_set_to_center();</div><div class="line"><a name="l00449"></a><span class="lineno"> 449</span>&#160; delay(300);</div><div class="line"><a name="l00450"></a><span class="lineno"> 450</span>&#160; servo_set_to_left();</div><div class="line"><a name="l00451"></a><span class="lineno"> 451</span>&#160; delay(100);</div><div class="line"><a name="l00452"></a><span class="lineno"> 452</span>&#160; servo_set_to_center();</div><div class="line"><a name="l00453"></a><span class="lineno"> 453</span>&#160; }</div><div class="line"><a name="l00454"></a><span class="lineno"> 454</span>&#160;}</div></div><!-- fragment -->
</div>
</div>
<a id="ga3b6f819fb82d910888fbc87abff1470c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3b6f819fb82d910888fbc87abff1470c">&#9670;&nbsp;</a></span>kitt()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void CodeRacer::kitt </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Fun stuff - you know Knightrider... </p>
<dl class="section return"><dt>Returns</dt><dd>nothing </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d4/da7/_code_racer_8cpp_source.html#l00459">459</a> of file <a class="el" href="../../d4/da7/_code_racer_8cpp_source.html">CodeRacer.cpp</a>.</p>
<div class="fragment"><div class="line"><a name="l00460"></a><span class="lineno"> 460</span>&#160;{</div><div class="line"><a name="l00461"></a><span class="lineno"> 461</span>&#160; <span class="keywordflow">if</span> (millis() - _last_led_switched_at_ms &gt; LED_SWITCH_MS) {</div><div class="line"><a name="l00462"></a><span class="lineno"> 462</span>&#160; _last_led_switched_at_ms = millis();</div><div class="line"><a name="l00463"></a><span class="lineno"> 463</span>&#160; <span class="keywordflow">if</span> (_last_led_on &gt;= 5) {</div><div class="line"><a name="l00464"></a><span class="lineno"> 464</span>&#160; _led_count = -1;</div><div class="line"><a name="l00465"></a><span class="lineno"> 465</span>&#160; }</div><div class="line"><a name="l00466"></a><span class="lineno"> 466</span>&#160; <span class="keywordflow">else</span> <span class="keywordflow">if</span> (_last_led_on &lt;= 0) {</div><div class="line"><a name="l00467"></a><span class="lineno"> 467</span>&#160; _led_count = 1;</div><div class="line"><a name="l00468"></a><span class="lineno"> 468</span>&#160; }</div><div class="line"><a name="l00469"></a><span class="lineno"> 469</span>&#160; _last_led_on = _last_led_on + _led_count;</div><div class="line"><a name="l00470"></a><span class="lineno"> 470</span>&#160; <span class="keywordflow">switch</span> (_last_led_on) {</div><div class="line"><a name="l00471"></a><span class="lineno"> 471</span>&#160; <span class="keywordflow">case</span> 0:</div><div class="line"><a name="l00472"></a><span class="lineno"> 472</span>&#160; set_leds_left_stop_frwd_right(LEDON, LEDOFF, LEDOFF, LEDOFF);</div><div class="line"><a name="l00473"></a><span class="lineno"> 473</span>&#160; <span class="keywordflow">break</span>;</div><div class="line"><a name="l00474"></a><span class="lineno"> 474</span>&#160; <span class="keywordflow">case</span> 1:</div><div class="line"><a name="l00475"></a><span class="lineno"> 475</span>&#160; set_leds_left_stop_frwd_right(LEDON, LEDOFF, LEDOFF, LEDOFF);</div><div class="line"><a name="l00476"></a><span class="lineno"> 476</span>&#160; <span class="keywordflow">break</span>;</div><div class="line"><a name="l00477"></a><span class="lineno"> 477</span>&#160; <span class="keywordflow">case</span> 2:</div><div class="line"><a name="l00478"></a><span class="lineno"> 478</span>&#160; set_leds_left_stop_frwd_right(LEDOFF, LEDON, LEDOFF, LEDOFF);</div><div class="line"><a name="l00479"></a><span class="lineno"> 479</span>&#160; <span class="keywordflow">break</span>;</div><div class="line"><a name="l00480"></a><span class="lineno"> 480</span>&#160; <span class="keywordflow">case</span> 3:</div><div class="line"><a name="l00481"></a><span class="lineno"> 481</span>&#160; set_leds_left_stop_frwd_right(LEDOFF, LEDOFF, LEDON, LEDOFF);</div><div class="line"><a name="l00482"></a><span class="lineno"> 482</span>&#160; <span class="keywordflow">break</span>;</div><div class="line"><a name="l00483"></a><span class="lineno"> 483</span>&#160; <span class="keywordflow">case</span> 4:</div><div class="line"><a name="l00484"></a><span class="lineno"> 484</span>&#160; <span class="keywordflow">case</span> 5:</div><div class="line"><a name="l00485"></a><span class="lineno"> 485</span>&#160; set_leds_left_stop_frwd_right(LEDOFF, LEDOFF, LEDOFF, LEDON);</div><div class="line"><a name="l00486"></a><span class="lineno"> 486</span>&#160; <span class="keywordflow">break</span>;</div><div class="line"><a name="l00487"></a><span class="lineno"> 487</span>&#160; }</div><div class="line"><a name="l00488"></a><span class="lineno"> 488</span>&#160; }</div><div class="line"><a name="l00489"></a><span class="lineno"> 489</span>&#160;}</div></div><!-- fragment -->
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
</ul>
</div>
</body>
</html>