aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/arduino/attachinterrupt.rst
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@mit.edu>2010-12-21 10:27:37 -0500
committerMarti Bolivar <mbolivar@mit.edu>2010-12-21 10:27:37 -0500
commitc45bccad44187da27505cf5808424e709e3f54a1 (patch)
tree18a459a50f8d0551ba046e30462c93999d982725 /docs/source/arduino/attachinterrupt.rst
parent84fd2532a7f23d20354ff590790b3f892cb7e7d7 (diff)
parentd5ad2a27f4e69e6cc9324331945937c983c30366 (diff)
downloadlibrambutan-c45bccad44187da27505cf5808424e709e3f54a1.tar.gz
librambutan-c45bccad44187da27505cf5808424e709e3f54a1.zip
Merge branch 'master' into debug-serialusb.
Chose debug-serialusb version in cases of conflict. Conflicts: libmaple/usb/usb_callbacks.c
Diffstat (limited to 'docs/source/arduino/attachinterrupt.rst')
-rw-r--r--docs/source/arduino/attachinterrupt.rst93
1 files changed, 0 insertions, 93 deletions
diff --git a/docs/source/arduino/attachinterrupt.rst b/docs/source/arduino/attachinterrupt.rst
deleted file mode 100644
index 189141b..0000000
--- a/docs/source/arduino/attachinterrupt.rst
+++ /dev/null
@@ -1,93 +0,0 @@
-.. highlight:: cpp
-
-.. _arduino-attachinterrupt:
-
-attachInterrupt(interrupt, function, mode)
-==========================================
-
-.. doxygenfunction:: attachInterrupt
-
-.. doxygenenum:: ExtIntTriggerMode
-
-.. doxygentypedef:: voidFuncPtr
-
-Discussion
-----------
-
-Specifies a function to call when an external interrupt occurs.
-Replaces any previous function that was attached to the interrupt.
-For more information on external interrupts on the Maple
-
-Note
-----
-
-Inside the attached function, delay() won't work, and the value
-returned by millis() will not increment. Serial data received while in
-the function may be lost. You should declare as volatile any variables
-that you modify within the attached function.
-
-
-Using Interrupts
-----------------
-
-Interrupts are useful for making things happen automatically in
-microcontroller programs, and can help solve timing problems. A
-good task for using an interrupt might be reading a rotary encoder,
-monitoring user input.
-
-
-
-If you wanted to insure that a program always caught the pulses
-from a rotary encoder, never missing a pulse, it would make it very
-tricky to write a program to do anything else, because the program
-would need to constantly poll the sensor lines for the encoder, in
-order to catch pulses when they occurred. Other sensors have a
-similar interface dynamic too, such as trying to read a sound
-sensor that is trying to catch a click, or an infrared slot sensor
-(photo-interrupter) trying to catch a coin drop. In all of these
-situations, using an interrupt can free the microcontroller to get
-some other work done while not missing the doorbell.
-
-
-
-Example
--------
-
-::
-
- int maple_led_pin = 13;
- volatile int state = LOW;
-
- void setup()
- {
- pinMode(maple_led_pin, OUTPUT);
- attachInterrupt(0, blink, CHANGE);
- }
-
- void loop()
- {
- digitalWrite(maple_led_pin, state);
- }
-
- void blink()
- {
- state = !state;
- }
-
-
-Arduino Compatibility Note
---------------------------
-
-Most Arduino boards have two external interrupts: numbers 0 (on
-digital pin 2) and 1 (on digital pin 3). The Arduino Mega has an
-additional four: numbers 2 (pin 21), 3 (pin 20), 4 (pin 19), and 5
-(pin 18).
-
-
-See also
---------
-
-
-- `detachInterrupt <http://arduino.cc/en/Reference/DetachInterrupt>`_
-
-