Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
7 views

Programming-Arduino (1) - Pages-146

Uploaded by

axl1994
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Programming-Arduino (1) - Pages-146

Uploaded by

axl1994
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

The following is the key line in the setup function of this sketch:

attachInterrupt(0, goFast, FALLING);

The first argument specifies which of the two interrupts you want to use. Rather
confusingly, a 0 here means you are using pin 2, while a 1 means you are using
pin 3.
The next argument is the name of the function that is to be called when there
is an interrupt, and the final argument is a constant that will be one of
CHANGE, RISING , or FALLING . Figure 7-4 summarizes these options.

Figure 7.4 Types of interrupt signals .

If the interrupt mode is CHANGE , then either a RISING from 0 to 1 or a


FALLING from 1 to 0 will both trigger an interrupt.
You can disable interrupts using the function noInterrupts . This stops all
interrupts from both interrupt channels. You can resume using interrupts again
by calling the function interrupts .
Different Arduino boards have different interrupt names for different pins so
if you are not using an Arduino Uno, check the documentation for your board on
http://www.arduino.cc .

Conclusion
In this chapter, you have looked at some of the handy features that the Arduino
standard library provides. These features will save you some programming
effort, and if there is one thing that a good programmer likes, it is being able to

You might also like