Skip to content
Snippets Groups Projects
_potentiometer_8h_source.html 12 KiB
Newer Older
mhamilt7's avatar
mhamilt7 committed
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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.18"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
Matthew's avatar
Matthew committed
<title>VizBlocks: src/Potentiometer.h Source File</title>
mhamilt7's avatar
mhamilt7 committed
<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="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="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">VizBlocks
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- 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>

Matthew's avatar
Matthew committed
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li>  </ul>
</div>
</div><!-- top -->
mhamilt7's avatar
mhamilt7 committed
<div class="header">
  <div class="headertitle">
<div class="title">Potentiometer.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_potentiometer_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifndef POTENTIOMETER_h</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#define POTENTIOMETER_h</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160; </div>
Matthew's avatar
Matthew committed
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &lt;Arduino.h&gt;</span></div>
mhamilt7's avatar
mhamilt7 committed
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160; </div>
Matthew's avatar
Matthew committed
<div class="line"><a name="l00006"></a><span class="lineno"><a class="line" href="class_potentiometer.html">    6</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_potentiometer.html">Potentiometer</a></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;{</div>
mhamilt7's avatar
mhamilt7 committed
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160; </div>
Matthew's avatar
Matthew committed
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;    <span class="keywordtype">int</span> EMA_S = 0;          <span class="comment">//initialization of EMA S</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;    <span class="keywordtype">float</span> EMA_a = 0.6;</div>
mhamilt7's avatar
mhamilt7 committed
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160; </div>
Matthew's avatar
Matthew committed
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;    <span class="keywordtype">int</span> _pin;</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;    <span class="keywordtype">int</span> _id;</div>
mhamilt7's avatar
mhamilt7 committed
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160; </div>
Matthew's avatar
Matthew committed
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;    <span class="keywordtype">int</span> _value;</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;    <span class="keywordtype">int</span> _previousReading;</div>
mhamilt7's avatar
mhamilt7 committed
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160; </div>
Matthew's avatar
Matthew committed
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;    <span class="keywordtype">bool</span> _inputFlag = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;    <span class="keywordtype">bool</span> _changeFlag = <span class="keyword">false</span>;</div>
mhamilt7's avatar
mhamilt7 committed
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160; </div>
Matthew's avatar
Matthew committed
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;    <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> _previousTimer;</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;    <span class="keywordtype">int</span> _interval = 200;</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160; </div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;    void (*_cb)(<a class="code" href="class_potentiometer.html">Potentiometer</a>*, uint8_t, uint8_t); <span class="comment">// Callback function</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="comment"></span>    <span class="keywordtype">int</span> _read();</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    <span class="keywordtype">void</span> _setValue(<span class="keywordtype">int</span> x);</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160; </div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160; </div>
<div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="class_potentiometer.html#a4898ad98a6a277551036a8b9558533df">   36</a></span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> uint8_t <a class="code" href="class_potentiometer.html#a4898ad98a6a277551036a8b9558533df">kEventStableUpdate</a> = 0;</div>
<div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="class_potentiometer.html#a06d7c4ac6942d9fad402d136f2bfa6ed">   37</a></span>&#160;    <span class="keyword">static</span> <span class="keyword">const</span> uint8_t <a class="code" href="class_potentiometer.html#a06d7c4ac6942d9fad402d136f2bfa6ed">kEventUnstableUpdate</a> = 1;</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160; </div>
<div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="class_potentiometer.html#af2f25ccdc72808fc5e4baeeb60fe9410">   39</a></span>&#160;    <a class="code" href="class_potentiometer.html#af2f25ccdc72808fc5e4baeeb60fe9410">Potentiometer</a>(<span class="keywordtype">int</span> pin, <span class="keywordtype">int</span> <span class="keywordtype">id</span> = 99);</div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="class_potentiometer.html#a17b7977261eebcac2d6d5dbcd7adf167">   43</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="class_potentiometer.html#a17b7977261eebcac2d6d5dbcd7adf167">setEventHandler</a>(<span class="keywordtype">void</span> (*<span class="keyword">function</span>)(<a class="code" href="class_potentiometer.html">Potentiometer</a>*, uint8_t, uint8_t));</div>
<div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="class_potentiometer.html#a0ee40840fe135d6f1799fecdbb4d9f70">   47</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_potentiometer.html#a0ee40840fe135d6f1799fecdbb4d9f70">getValue</a>();</div>
<div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="class_potentiometer.html#a70a53b8e012420e689a38d1751b4269e">   51</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_potentiometer.html#a70a53b8e012420e689a38d1751b4269e">getId</a>();</div>
<div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="class_potentiometer.html#a6a9caf03bab70816829c574ee7e88a6b">   55</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="class_potentiometer.html#a6a9caf03bab70816829c574ee7e88a6b">check</a>();</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;};</div>
mhamilt7's avatar
mhamilt7 committed
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160; </div>
Matthew's avatar
Matthew committed
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="preprocessor">#endif</span></div>
mhamilt7's avatar
mhamilt7 committed
</div><!-- fragment --></div><!-- contents -->
Matthew's avatar
Matthew committed
<div class="ttc" id="aclass_potentiometer_html_a6a9caf03bab70816829c574ee7e88a6b"><div class="ttname"><a href="class_potentiometer.html#a6a9caf03bab70816829c574ee7e88a6b">Potentiometer::check</a></div><div class="ttdeci">void check()</div><div class="ttdoc">What does this do?</div></div>
<div class="ttc" id="aclass_potentiometer_html_a4898ad98a6a277551036a8b9558533df"><div class="ttname"><a href="class_potentiometer.html#a4898ad98a6a277551036a8b9558533df">Potentiometer::kEventStableUpdate</a></div><div class="ttdeci">static const uint8_t kEventStableUpdate</div><div class="ttdef"><b>Definition:</b> Potentiometer.h:36</div></div>
<div class="ttc" id="aclass_potentiometer_html_af2f25ccdc72808fc5e4baeeb60fe9410"><div class="ttname"><a href="class_potentiometer.html#af2f25ccdc72808fc5e4baeeb60fe9410">Potentiometer::Potentiometer</a></div><div class="ttdeci">Potentiometer(int pin, int id=99)</div></div>
<div class="ttc" id="aclass_potentiometer_html"><div class="ttname"><a href="class_potentiometer.html">Potentiometer</a></div><div class="ttdef"><b>Definition:</b> Potentiometer.h:7</div></div>
<div class="ttc" id="aclass_potentiometer_html_a70a53b8e012420e689a38d1751b4269e"><div class="ttname"><a href="class_potentiometer.html#a70a53b8e012420e689a38d1751b4269e">Potentiometer::getId</a></div><div class="ttdeci">int getId()</div><div class="ttdoc">What does this do?</div></div>
<div class="ttc" id="aclass_potentiometer_html_a17b7977261eebcac2d6d5dbcd7adf167"><div class="ttname"><a href="class_potentiometer.html#a17b7977261eebcac2d6d5dbcd7adf167">Potentiometer::setEventHandler</a></div><div class="ttdeci">void setEventHandler(void(*function)(Potentiometer *, uint8_t, uint8_t))</div><div class="ttdoc">What does this do?</div></div>
<div class="ttc" id="aclass_potentiometer_html_a06d7c4ac6942d9fad402d136f2bfa6ed"><div class="ttname"><a href="class_potentiometer.html#a06d7c4ac6942d9fad402d136f2bfa6ed">Potentiometer::kEventUnstableUpdate</a></div><div class="ttdeci">static const uint8_t kEventUnstableUpdate</div><div class="ttdef"><b>Definition:</b> Potentiometer.h:37</div></div>
<div class="ttc" id="aclass_potentiometer_html_a0ee40840fe135d6f1799fecdbb4d9f70"><div class="ttname"><a href="class_potentiometer.html#a0ee40840fe135d6f1799fecdbb4d9f70">Potentiometer::getValue</a></div><div class="ttdeci">int getValue()</div><div class="ttdoc">What does this do?</div></div>
mhamilt7's avatar
mhamilt7 committed
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
</html>