Skip to content

Instantly share code, notes, and snippets.

@matael
Created May 4, 2014 20:13
Show Gist options
  • Save matael/11523180 to your computer and use it in GitHub Desktop.
Save matael/11523180 to your computer and use it in GitHub Desktop.
//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