Advertisement
uas_arduino

Simple Interrupt

Mar 22nd, 2013
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #define OUTPUT_PIN 9
  2. #define INPUT_PIN 0  //This is actually digital pin 2!
  3.  
  4. volatile int value = LOW;
  5.  
  6. void blinkLed(){
  7.   value = !value;
  8. }
  9.  
  10. void setup(){
  11.   Serial.begin(9600);
  12.   pinMode(OUTPUT_PIN, OUTPUT);
  13.   attachInterrupt(0, blinkLed, LOW);
  14. }
  15.  
  16. void loop(){
  17.   Serial.println(value,HEX);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement