index.html 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6. <meta name="generator" content="Doxygen 1.8.13"/>
  7. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  8. <title>Bounce2: BOUNCE 2</title>
  9. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  10. <script type="text/javascript" src="jquery.js"></script>
  11. <script type="text/javascript" src="dynsections.js"></script>
  12. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  13. <script type="text/javascript" src="search/searchdata.js"></script>
  14. <script type="text/javascript" src="search/search.js"></script>
  15. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  19. <div id="titlearea">
  20. <table cellspacing="0" cellpadding="0">
  21. <tbody>
  22. <tr style="height: 56px;">
  23. <td id="projectalign" style="padding-left: 0.5em;">
  24. <div id="projectname">Bounce2
  25. </div>
  26. </td>
  27. </tr>
  28. </tbody>
  29. </table>
  30. </div>
  31. <!-- end header part -->
  32. <!-- Generated by Doxygen 1.8.13 -->
  33. <script type="text/javascript">
  34. var searchBox = new SearchBox("searchBox", "search",false,'Search');
  35. </script>
  36. <script type="text/javascript" src="menudata.js"></script>
  37. <script type="text/javascript" src="menu.js"></script>
  38. <script type="text/javascript">
  39. $(function() {
  40. initMenu('',true,false,'search.php','Search');
  41. $(document).ready(function() { init_search(); });
  42. });
  43. </script>
  44. <div id="main-nav"></div>
  45. </div><!-- top -->
  46. <!-- window showing the filter options -->
  47. <div id="MSearchSelectWindow"
  48. onmouseover="return searchBox.OnSearchSelectShow()"
  49. onmouseout="return searchBox.OnSearchSelectHide()"
  50. onkeydown="return searchBox.OnSearchSelectKey(event)">
  51. </div>
  52. <!-- iframe showing the search results (closed by default) -->
  53. <div id="MSearchResultsWindow">
  54. <iframe src="javascript:void(0)" frameborder="0"
  55. name="MSearchResults" id="MSearchResults">
  56. </iframe>
  57. </div>
  58. <div class="header">
  59. <div class="headertitle">
  60. <div class="title">BOUNCE 2 </div> </div>
  61. </div><!--header-->
  62. <div class="contents">
  63. <div class="textblock"><p>Debouncing library for Arduino and Wiring by Thomas Ouellet Fredericks with contributions from: Eric Lowry, Jim Schimpf, Tom Harkaway, Joachim Krüger and MrGradgrind.</p>
  64. <p>More about debouncing: <a href="http://en.wikipedia.org/wiki/Debounce#Contact_bounce">http://en.wikipedia.org/wiki/Debounce#Contact_bounce</a></p>
  65. <p>See the bottom of this page for a basic usage example and the "examples" folder for more.</p>
  66. <h2>GITHUB PAGE</h2>
  67. <p><a href="https://github.com/thomasfredericks/Bounce2">https://github.com/thomasfredericks/Bounce2</a></p>
  68. <h2>DOCUMENTATION</h2>
  69. <p>The complete class documentation can be found in the "docs" folder or <a href="http://thomasfredericks.github.io/Bounce2/">online here</a>.</p>
  70. <h1>HAVE A QUESTION?</h1>
  71. <p>Please post your questions <a href="http://forum.arduino.cc/index.php?topic=266132.0">here</a>.</p>
  72. <h1>INSTALLATION &amp; DOWNLOAD</h1>
  73. <p>Install through your software's Library Manager or download the latest version <a href="https://github.com/thomasfredericks/Bounce2/archive/master.zip">here</a> and put the "Bounce2" folder in your "libraries" folder.</p>
  74. <p>The original version of <a class="el" href="class_bounce.html">Bounce</a> (<a class="el" href="class_bounce.html">Bounce</a> 1) is included in the download but not supported anymore.</p>
  75. <h1>DEBOUNCE ALGORITHMS (FOR ADVANCED USERS)</h1>
  76. <h2>STABLE INTERVAL</h2>
  77. <p>By default, the <a class="el" href="class_bounce.html">Bounce</a> library uses a stable interval to process the debouncing. This is simpler to understand and can cancel unwanted noise.</p>
  78. <div class="image">
  79. <img src="https://raw.github.com/thomasfredericks/Bounce-Arduino-Wiring/master/extras/BouncySwitch_stable.png"/>
  80. </div>
  81. <h2>LOCK-OUT INTERVAL</h2>
  82. <p>By defining "#define BOUNCE_LOCK_OUT" in "Bounce.h" (or in your code before including "Bounce.h") you can activate an alternative debouncing method. This method is a lot more responsive, but does not cancel noise.</p>
  83. <div class="fragment"><div class="line">#define BOUNCE_LOCK_OUT</div></div><!-- fragment --><div class="image">
  84. <img src="https://raw.github.com/thomasfredericks/Bounce-Arduino-Wiring/master/extras/BouncySwitch_lockout.png"/>
  85. </div>
  86. <h2>WITH PROMPT DETECTION</h2>
  87. <p>By defining "#define BOUNCE_WITH_PROMPT_DETECTION" in "Bounce.h" (or in your code before including "Bounce.h") you can activate an alternative debouncing method. Button state changes are available immediately so long as the previous state has been stable for the timeout period. Otherwise the state will be updated as soon as the timeout period allows.</p>
  88. <ul>
  89. <li>Able to report acurate switch time normally with no delay.</li>
  90. <li>Use when accurate switch transition timing is important.</li>
  91. </ul>
  92. <div class="fragment"><div class="line">#define BOUNCE_WITH_PROMPT_DETECTION</div></div><!-- fragment --><h1>BASIC EXAMPLE</h1>
  93. <div class="fragment"><div class="line"><span class="comment">// This example toggles the debug LED (pin 13) on or off</span></div><div class="line"><span class="comment">// when a button on pin 2 is pressed.</span></div><div class="line"></div><div class="line"><span class="comment">// Include the Bounce2 library found here :</span></div><div class="line"><span class="comment">// https://github.com/thomasfredericks/Bounce2</span></div><div class="line"><span class="preprocessor">#include &lt;Bounce2.h&gt;</span></div><div class="line"></div><div class="line"><span class="preprocessor">#define BUTTON_PIN 2</span></div><div class="line"><span class="preprocessor">#define LED_PIN 13</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> ledState = LOW;</div><div class="line"></div><div class="line"></div><div class="line"><a class="code" href="class_bounce.html">Bounce</a> debouncer = <a class="code" href="class_bounce.html">Bounce</a>(); <span class="comment">// Instantiate a Bounce object</span></div><div class="line"></div><div class="line"><span class="keywordtype">void</span> setup() {</div><div class="line"></div><div class="line"> debouncer.<a class="code" href="class_bounce.html#aba08e592941465d033e3eba3dde66eaf">attach</a>(BUTTON_PIN,INPUT_PULLUP); <span class="comment">// Attach the debouncer to a pin with INPUT_PULLUP mode</span></div><div class="line"> debouncer.<a class="code" href="class_bounce.html#a2c6e68bf749497c597a9437b488b3d7c">interval</a>(25); <span class="comment">// Use a debounce interval of 25 milliseconds</span></div><div class="line"></div><div class="line"></div><div class="line"> pinMode(LED_PIN,OUTPUT); <span class="comment">// Setup the LED</span></div><div class="line"> digitalWrite(LED_PIN,ledState);</div><div class="line"></div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> loop() {</div><div class="line"></div><div class="line"> debouncer.<a class="code" href="class_bounce.html#ab36d7b83bf32e0935a0c2c6a05096441">update</a>(); <span class="comment">// Update the Bounce instance</span></div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> ( debouncer.<a class="code" href="class_bounce.html#abfbb0910f5b1ec4e25315cff26dd6289">fell</a>() ) { <span class="comment">// Call code if button transitions from HIGH to LOW</span></div><div class="line"> ledState = !ledState; <span class="comment">// Toggle LED state</span></div><div class="line"> digitalWrite(LED_PIN,ledState); <span class="comment">// Apply new LED state</span></div><div class="line"> }</div><div class="line">}</div></div><!-- fragment --> </div></div><!-- contents -->
  94. <!-- start footer part -->
  95. <hr class="footer"/><address class="footer"><small>
  96. Generated by &#160;<a href="http://www.doxygen.org/index.html">
  97. <img class="footer" src="doxygen.png" alt="doxygen"/>
  98. </a> 1.8.13
  99. </small></address>
  100. </body>
  101. </html>