Created
May 4, 2014 20:13
-
-
Save matael/11523180 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//interruption | |
// on arrete ce qu'on faisais pour aller traiter l'évenement | |
const byte LED = 13; | |
const byte BUTTON = 2; | |
// Interrupt Service Routine (ISR) | |
void pin_rising () | |
{ | |
digitalWrite(LED, HIGH); | |
} | |
void pin_falling () | |
{ | |
digitalWrite(LED, LOW); | |
} | |
void setup () { | |
pinMode (LED, OUTPUT); // so we can update the LED | |
digitalWrite (BUTTON, HIGH); // internal pull-up resistor | |
attachInterrupt (0, pin_rising, RISING); // attach interrupt handler | |
attachInterrupt (0, pin_falling, FALLING); // attach interrupt handler | |
} // end of setup | |
void loop () | |
{ | |
// loop | |
// doing | |
// nothing | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment