Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Letzte ÜberarbeitungBeide Seiten der Revision
project:arduino-kickstarter-105 [14.01.2013 15:56] – Externe Bearbeitung 127.0.0.1project:arduino-kickstarter-105 [20.11.2013 21:27] paalsteek
Zeile 17: Zeile 17:
   const int buttonPin = 2;     // the number of the pushbutton pin   const int buttonPin = 2;     // the number of the pushbutton pin
   const int ledPin =  13;      // the number of the LED pin   const int ledPin =  13;      // the number of the LED pin
 +  
   // Variables will change:   // Variables will change:
   int ledState = HIGH;         // the current state of the output pin   int ledState = HIGH;         // the current state of the output pin
   int buttonState;             // the current reading from the input pin   int buttonState;             // the current reading from the input pin
   int lastButtonState = LOW;   // the previous reading from the input pin   int lastButtonState = LOW;   // the previous reading from the input pin
 +  
   // the following variables are long's because the time, measured in miliseconds,   // the following variables are long's because the time, measured in miliseconds,
   // will quickly become a bigger number than can be stored in an int.   // will quickly become a bigger number than can be stored in an int.
   long lastDebounceTime = 0;  // the last time the output pin was toggled   long lastDebounceTime = 0;  // the last time the output pin was toggled
   long debounceDelay = 50;    // the debounce time; increase if the output flickers   long debounceDelay = 50;    // the debounce time; increase if the output flickers
 +  
   void setup() {   void setup() {
     pinMode(buttonPin, INPUT);     pinMode(buttonPin, INPUT);
     pinMode(ledPin, OUTPUT);     pinMode(ledPin, OUTPUT);
   }   }
 +  
   void loop() {   void loop() {
     // read the state of the switch into a local variable:     // read the state of the switch into a local variable:
Zeile 55: Zeile 55:
     // set the LED using the state of the button:     // set the LED using the state of the button:
     digitalWrite(ledPin, buttonState);     digitalWrite(ledPin, buttonState);
 +  
     // save the reading.  Next time through the loop,     // save the reading.  Next time through the loop,
     // it'll be the lastButtonState:     // it'll be the lastButtonState:
project/arduino-kickstarter-105.txt · Zuletzt geändert: 20.11.2013 21:27 von paalsteek
Falls nicht anders bezeichnet, ist der Inhalt dieses Wikis unter der folgenden Lizenz veröffentlicht: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Driven by DokuWiki