<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://lms.onnocenter.or.id/wiki/index.php?action=history&amp;feed=atom&amp;title=Arduino%3A_Debounce</id>
	<title>Arduino: Debounce - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://lms.onnocenter.or.id/wiki/index.php?action=history&amp;feed=atom&amp;title=Arduino%3A_Debounce"/>
	<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=Arduino:_Debounce&amp;action=history"/>
	<updated>2026-04-20T15:47:43Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://lms.onnocenter.or.id/wiki/index.php?title=Arduino:_Debounce&amp;diff=45227&amp;oldid=prev</id>
		<title>Onnowpurbo: New page: Sumber: https://www.arduino.cc/en/Tutorial/Debounce   ==Hardware Required==  * Arduino or Genuino Board * momentary button or switch * 10k ohm resistor * hook-up wires * breadboard    ==Ra...</title>
		<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=Arduino:_Debounce&amp;diff=45227&amp;oldid=prev"/>
		<updated>2015-12-04T03:08:00Z</updated>

		<summary type="html">&lt;p&gt;New page: Sumber: https://www.arduino.cc/en/Tutorial/Debounce   ==Hardware Required==  * Arduino or Genuino Board * momentary button or switch * 10k ohm resistor * hook-up wires * breadboard    ==Ra...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Sumber: https://www.arduino.cc/en/Tutorial/Debounce&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Hardware Required==&lt;br /&gt;
&lt;br /&gt;
* Arduino or Genuino Board&lt;br /&gt;
* momentary button or switch&lt;br /&gt;
* 10k ohm resistor&lt;br /&gt;
* hook-up wires&lt;br /&gt;
* breadboard &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Rangkaian==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Button.png|center|200px|thumb]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Button sch.png|center|200px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&lt;br /&gt;
 /*&lt;br /&gt;
  Debounce&lt;br /&gt;
 &lt;br /&gt;
  Each time the input pin goes from LOW to HIGH (e.g. because of a push-button&lt;br /&gt;
  press), the output pin is toggled from LOW to HIGH or HIGH to LOW.  There&amp;#039;s&lt;br /&gt;
  a minimum delay between toggles to debounce the circuit (i.e. to ignore&lt;br /&gt;
  noise).&lt;br /&gt;
 &lt;br /&gt;
  The circuit:&lt;br /&gt;
  * LED attached from pin 13 to ground&lt;br /&gt;
  * pushbutton attached from pin 2 to +5V&lt;br /&gt;
  * 10K resistor attached from pin 2 to ground&lt;br /&gt;
 &lt;br /&gt;
  * Note: On most Arduino boards, there is already an LED on the board&lt;br /&gt;
  connected to pin 13, so you don&amp;#039;t need any extra components for this example.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
  created 21 November 2006&lt;br /&gt;
  by David A. Mellis&lt;br /&gt;
  modified 30 Aug 2011&lt;br /&gt;
  by Limor Fried&lt;br /&gt;
  modified 28 Dec 2012&lt;br /&gt;
  by Mike Walters&lt;br /&gt;
 &lt;br /&gt;
  This example code is in the public domain.&lt;br /&gt;
 &lt;br /&gt;
  http://www.arduino.cc/en/Tutorial/Debounce&lt;br /&gt;
  */&lt;br /&gt;
 &lt;br /&gt;
 // constants won&amp;#039;t change. They&amp;#039;re used here to&lt;br /&gt;
 // set pin numbers:&lt;br /&gt;
 const int buttonPin = 2;    // the number of the pushbutton pin&lt;br /&gt;
 const int ledPin = 13;      // the number of the LED pin&lt;br /&gt;
 &lt;br /&gt;
 // Variables will change:&lt;br /&gt;
 int ledState = HIGH;         // the current state of the output pin&lt;br /&gt;
 int buttonState;             // the current reading from the input pin&lt;br /&gt;
 int lastButtonState = LOW;   // the previous reading from the input pin &lt;br /&gt;
 &lt;br /&gt;
 // the following variables are long&amp;#039;s because the time, measured in miliseconds,&lt;br /&gt;
 // will quickly become a bigger number than can be stored in an int.&lt;br /&gt;
 long lastDebounceTime = 0;  // the last time the output pin was toggled&lt;br /&gt;
 long debounceDelay = 50;    // the debounce time; increase if the output flickers&lt;br /&gt;
 &lt;br /&gt;
 void setup() {&lt;br /&gt;
   pinMode(buttonPin, INPUT);&lt;br /&gt;
   pinMode(ledPin, OUTPUT);&lt;br /&gt;
 &lt;br /&gt;
   // set initial LED state&lt;br /&gt;
   digitalWrite(ledPin, ledState);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void loop() {&lt;br /&gt;
   // read the state of the switch into a local variable:&lt;br /&gt;
   int reading = digitalRead(buttonPin); &lt;br /&gt;
 &lt;br /&gt;
   // check to see if you just pressed the button&lt;br /&gt;
   // (i.e. the input went from LOW to HIGH),  and you&amp;#039;ve waited&lt;br /&gt;
   // long enough since the last press to ignore any noise: &lt;br /&gt;
 &lt;br /&gt;
   // If the switch changed, due to noise or pressing:&lt;br /&gt;
   if (reading != lastButtonState) {&lt;br /&gt;
     // reset the debouncing timer&lt;br /&gt;
     lastDebounceTime = millis();&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   if ((millis() - lastDebounceTime) &amp;gt; debounceDelay) {&lt;br /&gt;
     // whatever the reading is at, it&amp;#039;s been there for longer&lt;br /&gt;
     // than the debounce delay, so take it as the actual current state:    &lt;br /&gt;
 &lt;br /&gt;
     // if the button state has changed:&lt;br /&gt;
     if (reading != buttonState) {&lt;br /&gt;
       buttonState = reading;&lt;br /&gt;
 &lt;br /&gt;
       // only toggle the LED if the new button state is HIGH&lt;br /&gt;
       if (buttonState == HIGH) {&lt;br /&gt;
         ledState = !ledState;&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   // set the LED:&lt;br /&gt;
   digitalWrite(ledPin, ledState);&lt;br /&gt;
 &lt;br /&gt;
   // save the reading.  Next time through the loop,&lt;br /&gt;
   // it&amp;#039;ll be the lastButtonState:&lt;br /&gt;
   lastButtonState = reading;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Referensi==&lt;br /&gt;
&lt;br /&gt;
* https://www.arduino.cc/en/Tutorial/Debounce&lt;/div&gt;</summary>
		<author><name>Onnowpurbo</name></author>
	</entry>
</feed>