123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- <!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>Bounce2: Bounce Class Reference</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="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">Bounce2
- </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>
- <!-- 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><!-- top -->
- <div class="header">
- <div class="summary">
- <a href="#pub-methods">Public Member Functions</a> |
- <a href="#pro-methods">Protected Member Functions</a> |
- <a href="#pro-attribs">Protected Attributes</a> |
- <a href="class_bounce-members.html">List of all members</a> </div>
- <div class="headertitle">
- <div class="title">Bounce Class Reference</div> </div>
- </div><!--header-->
- <div class="contents">
- <p><code>#include <<a class="el" href="_bounce2_8h_source.html">Bounce2.h</a>></code></p>
- <table class="memberdecls">
- <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
- Public Member Functions</h2></td></tr>
- <tr class="memitem:aa62a2e2b5ad0ee6913a95f2f2a0e7606"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_bounce.html#aa62a2e2b5ad0ee6913a95f2f2a0e7606">Bounce</a> ()</td></tr>
- <tr class="memdesc:aa62a2e2b5ad0ee6913a95f2f2a0e7606"><td class="mdescLeft"> </td><td class="mdescRight">Create an instance of the <a class="el" href="class_bounce.html">Bounce</a> class. <a href="#aa62a2e2b5ad0ee6913a95f2f2a0e7606">More...</a><br /></td></tr>
- <tr class="separator:aa62a2e2b5ad0ee6913a95f2f2a0e7606"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:aba08e592941465d033e3eba3dde66eaf"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_bounce.html#aba08e592941465d033e3eba3dde66eaf">attach</a> (int pin, int mode)</td></tr>
- <tr class="memdesc:aba08e592941465d033e3eba3dde66eaf"><td class="mdescLeft"> </td><td class="mdescRight">Attach to a pin and sets that pin's mode (INPUT, INPUT_PULLUP or OUTPUT). <a href="#aba08e592941465d033e3eba3dde66eaf">More...</a><br /></td></tr>
- <tr class="separator:aba08e592941465d033e3eba3dde66eaf"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a163477dbcbaf1a3dee6cb3b62eedf09e"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_bounce.html#a163477dbcbaf1a3dee6cb3b62eedf09e">attach</a> (int pin)</td></tr>
- <tr class="separator:a163477dbcbaf1a3dee6cb3b62eedf09e"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a2c6e68bf749497c597a9437b488b3d7c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_bounce.html#a2c6e68bf749497c597a9437b488b3d7c">interval</a> (uint16_t interval_millis)</td></tr>
- <tr class="memdesc:a2c6e68bf749497c597a9437b488b3d7c"><td class="mdescLeft"> </td><td class="mdescRight">Sets the debounce interval in milliseconds. <a href="#a2c6e68bf749497c597a9437b488b3d7c">More...</a><br /></td></tr>
- <tr class="separator:a2c6e68bf749497c597a9437b488b3d7c"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:ab36d7b83bf32e0935a0c2c6a05096441"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_bounce.html#ab36d7b83bf32e0935a0c2c6a05096441">update</a> ()</td></tr>
- <tr class="memdesc:ab36d7b83bf32e0935a0c2c6a05096441"><td class="mdescLeft"> </td><td class="mdescRight">Updates the pin's state. <a href="#ab36d7b83bf32e0935a0c2c6a05096441">More...</a><br /></td></tr>
- <tr class="separator:ab36d7b83bf32e0935a0c2c6a05096441"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:ae1936fdf44501992707e6cbaee9bbc76"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_bounce.html#ae1936fdf44501992707e6cbaee9bbc76">read</a> ()</td></tr>
- <tr class="memdesc:ae1936fdf44501992707e6cbaee9bbc76"><td class="mdescLeft"> </td><td class="mdescRight">Returns the pin's state (HIGH or LOW). <a href="#ae1936fdf44501992707e6cbaee9bbc76">More...</a><br /></td></tr>
- <tr class="separator:ae1936fdf44501992707e6cbaee9bbc76"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:abfbb0910f5b1ec4e25315cff26dd6289"><td class="memItemLeft" align="right" valign="top"><a id="abfbb0910f5b1ec4e25315cff26dd6289"></a>
- bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_bounce.html#abfbb0910f5b1ec4e25315cff26dd6289">fell</a> ()</td></tr>
- <tr class="memdesc:abfbb0910f5b1ec4e25315cff26dd6289"><td class="mdescLeft"> </td><td class="mdescRight">Returns true if pin signal transitions from high to low. <br /></td></tr>
- <tr class="separator:abfbb0910f5b1ec4e25315cff26dd6289"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a9e4187934576e568cdfa8f94efeff6f2"><td class="memItemLeft" align="right" valign="top"><a id="a9e4187934576e568cdfa8f94efeff6f2"></a>
- bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_bounce.html#a9e4187934576e568cdfa8f94efeff6f2">rose</a> ()</td></tr>
- <tr class="memdesc:a9e4187934576e568cdfa8f94efeff6f2"><td class="mdescLeft"> </td><td class="mdescRight">Returns true if pin signal transitions from low to high. <br /></td></tr>
- <tr class="separator:a9e4187934576e568cdfa8f94efeff6f2"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a3417beb80eb6593d768c2e9884c57aa0"><td class="memItemLeft" align="right" valign="top"><a id="a3417beb80eb6593d768c2e9884c57aa0"></a>
- bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_bounce.html#a3417beb80eb6593d768c2e9884c57aa0">risingEdge</a> ()</td></tr>
- <tr class="memdesc:a3417beb80eb6593d768c2e9884c57aa0"><td class="mdescLeft"> </td><td class="mdescRight">Deprecated (i.e. do not use). Included for partial compatibility for programs written with <a class="el" href="class_bounce.html">Bounce</a> version 1. <br /></td></tr>
- <tr class="separator:a3417beb80eb6593d768c2e9884c57aa0"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:ac756559419bfa1c5060e5e4a4ad6406f"><td class="memItemLeft" align="right" valign="top"><a id="ac756559419bfa1c5060e5e4a4ad6406f"></a>
- bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_bounce.html#ac756559419bfa1c5060e5e4a4ad6406f">fallingEdge</a> ()</td></tr>
- <tr class="memdesc:ac756559419bfa1c5060e5e4a4ad6406f"><td class="mdescLeft"> </td><td class="mdescRight">Deprecated (i.e. do not use). Included for partial compatibility for programs written with <a class="el" href="class_bounce.html">Bounce</a> version 1. <br /></td></tr>
- <tr class="separator:ac756559419bfa1c5060e5e4a4ad6406f"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:ab34517094faf21d4f38b36da2915132b"><td class="memItemLeft" align="right" valign="top"><a id="ab34517094faf21d4f38b36da2915132b"></a>
-  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_bounce.html#ab34517094faf21d4f38b36da2915132b">Bounce</a> (uint8_t pin, unsigned long interval_millis)</td></tr>
- <tr class="memdesc:ab34517094faf21d4f38b36da2915132b"><td class="mdescLeft"> </td><td class="mdescRight">Deprecated (i.e. do not use). Included for partial compatibility for programs written with <a class="el" href="class_bounce.html">Bounce</a> version 1. <br /></td></tr>
- <tr class="separator:ab34517094faf21d4f38b36da2915132b"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a62412d814d36102ab3d285e801d5d29a"><td class="memItemLeft" align="right" valign="top">unsigned long </td><td class="memItemRight" valign="bottom"><a class="el" href="class_bounce.html#a62412d814d36102ab3d285e801d5d29a">duration</a> ()</td></tr>
- <tr class="memdesc:a62412d814d36102ab3d285e801d5d29a"><td class="mdescLeft"> </td><td class="mdescRight">Returns the duration in milliseconds of the current state. <a href="#a62412d814d36102ab3d285e801d5d29a">More...</a><br /></td></tr>
- <tr class="separator:a62412d814d36102ab3d285e801d5d29a"><td class="memSeparator" colspan="2"> </td></tr>
- </table><table class="memberdecls">
- <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
- Protected Member Functions</h2></td></tr>
- <tr class="memitem:ad6efc6dd65035de20f015cc44be37873"><td class="memItemLeft" align="right" valign="top"><a id="ad6efc6dd65035de20f015cc44be37873"></a>
- virtual bool </td><td class="memItemRight" valign="bottom"><b>readCurrentState</b> ()</td></tr>
- <tr class="separator:ad6efc6dd65035de20f015cc44be37873"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a231a992bf2a1f4521043068e35eb50a6"><td class="memItemLeft" align="right" valign="top"><a id="a231a992bf2a1f4521043068e35eb50a6"></a>
- virtual void </td><td class="memItemRight" valign="bottom"><b>setPinMode</b> (int pin, int mode)</td></tr>
- <tr class="separator:a231a992bf2a1f4521043068e35eb50a6"><td class="memSeparator" colspan="2"> </td></tr>
- </table><table class="memberdecls">
- <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
- Protected Attributes</h2></td></tr>
- <tr class="memitem:a223ab27b8094acd12d77a3a9145f56c9"><td class="memItemLeft" align="right" valign="top"><a id="a223ab27b8094acd12d77a3a9145f56c9"></a>
- unsigned long </td><td class="memItemRight" valign="bottom"><b>previous_millis</b></td></tr>
- <tr class="separator:a223ab27b8094acd12d77a3a9145f56c9"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a8c1991db9415ccc5acf9b24779b332c7"><td class="memItemLeft" align="right" valign="top"><a id="a8c1991db9415ccc5acf9b24779b332c7"></a>
- uint16_t </td><td class="memItemRight" valign="bottom"><b>interval_millis</b></td></tr>
- <tr class="separator:a8c1991db9415ccc5acf9b24779b332c7"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:af013db8b02e1e252eb60dd5b40d5480b"><td class="memItemLeft" align="right" valign="top"><a id="af013db8b02e1e252eb60dd5b40d5480b"></a>
- uint8_t </td><td class="memItemRight" valign="bottom"><b>state</b></td></tr>
- <tr class="separator:af013db8b02e1e252eb60dd5b40d5480b"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a1cb79cb0ba2379cd12cc7c098d97053a"><td class="memItemLeft" align="right" valign="top"><a id="a1cb79cb0ba2379cd12cc7c098d97053a"></a>
- uint8_t </td><td class="memItemRight" valign="bottom"><b>pin</b></td></tr>
- <tr class="separator:a1cb79cb0ba2379cd12cc7c098d97053a"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:ad5aa630c50e7b783bac50aad0385262e"><td class="memItemLeft" align="right" valign="top"><a id="ad5aa630c50e7b783bac50aad0385262e"></a>
- unsigned long </td><td class="memItemRight" valign="bottom"><b>stateChangeLastTime</b></td></tr>
- <tr class="separator:ad5aa630c50e7b783bac50aad0385262e"><td class="memSeparator" colspan="2"> </td></tr>
- </table>
- <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
- <div class="textblock"><p>The <a class="el" href="class_bounce.html">Bounce</a> class. </p>
- </div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
- <a id="aa62a2e2b5ad0ee6913a95f2f2a0e7606"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#aa62a2e2b5ad0ee6913a95f2f2a0e7606">◆ </a></span>Bounce()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">Bounce::Bounce </td>
- <td>(</td>
- <td class="paramname"></td><td>)</td>
- <td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Create an instance of the <a class="el" href="class_bounce.html">Bounce</a> class. </p>
- <div class="fragment"><div class="line"><span class="comment">// Create an instance of the Bounce class.</span></div><div class="line"><a class="code" href="class_bounce.html#aa62a2e2b5ad0ee6913a95f2f2a0e7606">Bounce</a>() button;</div></div><!-- fragment -->
- </div>
- </div>
- <h2 class="groupheader">Member Function Documentation</h2>
- <a id="aba08e592941465d033e3eba3dde66eaf"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#aba08e592941465d033e3eba3dde66eaf">◆ </a></span>attach() <span class="overload">[1/2]</span></h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">void Bounce::attach </td>
- <td>(</td>
- <td class="paramtype">int </td>
- <td class="paramname"><em>pin</em>, </td>
- </tr>
- <tr>
- <td class="paramkey"></td>
- <td></td>
- <td class="paramtype">int </td>
- <td class="paramname"><em>mode</em> </td>
- </tr>
- <tr>
- <td></td>
- <td>)</td>
- <td></td><td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Attach to a pin and sets that pin's mode (INPUT, INPUT_PULLUP or OUTPUT). </p>
- <dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramname">pin</td><td>The pin that is to be debounced. </td></tr>
- <tr><td class="paramname">mode</td><td>A valid Arduino pin mode (INPUT, INPUT_PULLUP or OUTPUT). </td></tr>
- </table>
- </dd>
- </dl>
- <dl class="section return"><dt>Returns</dt><dd>True if the event read was successful, otherwise false. </dd></dl>
- </div>
- </div>
- <a id="a163477dbcbaf1a3dee6cb3b62eedf09e"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a163477dbcbaf1a3dee6cb3b62eedf09e">◆ </a></span>attach() <span class="overload">[2/2]</span></h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">void Bounce::attach </td>
- <td>(</td>
- <td class="paramtype">int </td>
- <td class="paramname"><em>pin</em></td><td>)</td>
- <td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Attach to a pin for advanced users. Only attach the pin this way once you have previously set it up. Otherwise use <a class="el" href="class_bounce.html#aba08e592941465d033e3eba3dde66eaf" title="Attach to a pin and sets that pin's mode (INPUT, INPUT_PULLUP or OUTPUT). ">attach(int pin, int mode)</a>. </p>
- </div>
- </div>
- <a id="a62412d814d36102ab3d285e801d5d29a"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a62412d814d36102ab3d285e801d5d29a">◆ </a></span>duration()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">unsigned long Bounce::duration </td>
- <td>(</td>
- <td class="paramname"></td><td>)</td>
- <td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Returns the duration in milliseconds of the current state. </p>
- <p>Is reset to 0 once the pin rises ( <a class="el" href="class_bounce.html#a9e4187934576e568cdfa8f94efeff6f2" title="Returns true if pin signal transitions from low to high. ">rose()</a> ) or falls ( <a class="el" href="class_bounce.html#abfbb0910f5b1ec4e25315cff26dd6289" title="Returns true if pin signal transitions from high to low. ">fell()</a> ).</p>
- <dl class="section return"><dt>Returns</dt><dd>The duration in milliseconds (unsigned long) of the current state. </dd></dl>
- </div>
- </div>
- <a id="a2c6e68bf749497c597a9437b488b3d7c"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a2c6e68bf749497c597a9437b488b3d7c">◆ </a></span>interval()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">void Bounce::interval </td>
- <td>(</td>
- <td class="paramtype">uint16_t </td>
- <td class="paramname"><em>interval_millis</em></td><td>)</td>
- <td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Sets the debounce interval in milliseconds. </p>
- <dl class="params"><dt>Parameters</dt><dd>
- <table class="params">
- <tr><td class="paramname">interval_millis</td><td>The interval time in milliseconds. </td></tr>
- </table>
- </dd>
- </dl>
- </div>
- </div>
- <a id="ae1936fdf44501992707e6cbaee9bbc76"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#ae1936fdf44501992707e6cbaee9bbc76">◆ </a></span>read()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">bool Bounce::read </td>
- <td>(</td>
- <td class="paramname"></td><td>)</td>
- <td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Returns the pin's state (HIGH or LOW). </p>
- <dl class="section return"><dt>Returns</dt><dd>HIGH or LOW. </dd></dl>
- </div>
- </div>
- <a id="ab36d7b83bf32e0935a0c2c6a05096441"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#ab36d7b83bf32e0935a0c2c6a05096441">◆ </a></span>update()</h2>
- <div class="memitem">
- <div class="memproto">
- <table class="memname">
- <tr>
- <td class="memname">bool Bounce::update </td>
- <td>(</td>
- <td class="paramname"></td><td>)</td>
- <td></td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Updates the pin's state. </p>
- <p>Because <a class="el" href="class_bounce.html">Bounce</a> does not use interrupts, you have to "update" the object before reading its value and it has to be done as often as possible (that means to include it in your loop()). Only call <a class="el" href="class_bounce.html#ab36d7b83bf32e0935a0c2c6a05096441" title="Updates the pin's state. ">update()</a> once per loop().</p>
- <dl class="section return"><dt>Returns</dt><dd>True if the pin changed state. </dd></dl>
- </div>
- </div>
- <hr/>The documentation for this class was generated from the following files:<ul>
- <li>src/<a class="el" href="_bounce2_8h_source.html">Bounce2.h</a></li>
- <li>src/Bounce2.cpp</li>
- </ul>
- </div><!-- contents -->
- <!-- start footer part -->
- <hr class="footer"/><address class="footer"><small>
- Generated by  <a href="http://www.doxygen.org/index.html">
- <img class="footer" src="doxygen.png" alt="doxygen"/>
- </a> 1.8.13
- </small></address>
- </body>
- </html>
|