Difference between revisions of "Interrupts()"

From Microduino Wiki
Jump to: navigation, search
(Created page with "interrupts() *'''Description''' Restart the interrupt(it will be forbidden after using noInterrupts() command). The interrupt allows some important tasks to run in the ba...")
 
 
Line 21: Line 21:
 
{
 
{
 
   noInterrupts();
 
   noInterrupts();
   //重要、时间敏感的代码
+
   //important and time-sensitive code
 
   interrupts();
 
   interrupts();
   //其他代码写在这里
+
   //write other codes here
 
}
 
}
  

Latest revision as of 03:51, 12 August 2016

interrupts()

  • Description

Restart the interrupt(it will be forbidden after using noInterrupts() command). The interrupt allows some important tasks to run in the background, and the state of it is enabled by default. After forbidding the interrupt, some functions may not be able to work, and the incoming information maybe ignores. The interrupt will slightly disturb the time of the code, so you can forbid the it in the key part.

  • Parameter

No

  • Return

No

  • Example

void setup() {
}
 
void loop()
{
  noInterrupts();
  //important and time-sensitive code 
  interrupts();
  //write other codes here 
}

[Return to Arduino Syntax Manual]