en-us_commands:reference:itimerset
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| en-us_commands:reference:itimerset [2026/09/08 00:53] – 바깥 편집 127.0.0.1 | en-us_commands:reference:itimerset [2026/09/12 22:54] (current) – 바깥 편집 127.0.0.1 | ||
|---|---|---|---|
| Line 15: | Line 15: | ||
| ===== Example ===== | ===== Example ===== | ||
| + | |||
| + | This uses the default callback timer (Timer2). The callback changes only a flag; serial output runs in '' | ||
| <code cpp> | <code cpp> | ||
| Line 24: | Line 26: | ||
| void setup() { | void setup() { | ||
| - | | + | |
| - | ItimerSet(1000, | + | |
| ItimerStart(); | ItimerStart(); | ||
| } | } | ||
| Line 31: | Line 33: | ||
| void loop() { | void loop() { | ||
| if (tick) { | if (tick) { | ||
| + | noInterrupts(); | ||
| tick = false; | tick = false; | ||
| - | | + | |
| + | Serial.println(F(" | ||
| } | } | ||
| } | } | ||
| Line 39: | Line 43: | ||
| ===== Precautions ===== | ===== Precautions ===== | ||
| - | * Timer interrupt | + | * The callback runs in an interrupt. |
| - | * Do not use slow or interrupt-dependent code such as '' | + | * The callback timer without |
| - | * Normally, call '' | + | * When specifying another hardware timer, check for conflicts |
| - | * Do not use the default '' | + | * A zero interval or missing |
| - | * Explicitly using Timer1, Timer3, Timer4 or Timer5 may conflict | + | |
| - | * Configure only one '' | + | |
| - | * Defining an ISR for the same timer directly in the sketch may conflict with '' | + | |
| - | * '' | + | |
| ===== Built-in Commands in the Same Category ===== | ===== Built-in Commands in the Same Category ===== | ||
en-us_commands/reference/itimerset.1788796403.txt.gz · Last modified: by 127.0.0.1
