Setting Up the Interrupts
/*
* Project: Week-08_Lab-1_ExternalInterrupts
* Author: Jane-Maree Howard
* Date: Monday 18/04/2010
* Platform: Arduino 18
* Purpose: To do nothing apart from demonstrating ISRs
(Interrupt Service Rountines).
For each of the 2 interrupt lines (0 & 1), its ISR
outputs a string to the Serial Monitor which identifies
the interrupt line number to which the ISR is attached
*/
const int buttonPin = 2; // Interrupt 0 - pushbutton pin
const int otherPin = 3; // Interrupt 1 - 'somethingElse' pin
void setup()
{
Serial.begin(9600);
// initialise Digital Pins
pinMode(buttonPin, INPUT);
pinMode(otherPin, INPUT);
// attach Interrupts
attachInterrupt(0, SM_Output_0, LOW);
attachInterrupt(1, SM_Output_1, LOW);
}//setup()
void loop()
{
}//loop()
/* Interrupt Service Routines */
// Output 0
void SM_Output_0()
{
Serial.println("\tInterrupt on line 0 - LOW\n");
}//SM_Output_0()
// Output 1
void SM_Output_1()
{
Serial.println("\tInterrupt on line 1\n");
}//SM_Output_1()
Showing posts with label Mike G. Show all posts
Showing posts with label Mike G. Show all posts
22 April 2010
Subscribe to:
Posts (Atom)
