en-us_commands:reference:iton
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en-us_commands:reference:iton [2026/09/07 23:35] – 바깥 편집 127.0.0.1 | en-us_commands:reference:iton [2026/09/14 20:30] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 14: | Line 14: | ||
| ===== Example ===== | ===== Example ===== | ||
| + | |||
| + | This example selects MPINO-8A4R(T)-S and uses input '' | ||
| <code cpp> | <code cpp> | ||
| - | const uint8_t | + | const uint8_t |
| - | const uint8_t | + | const uint8_t |
| - | const uint8_t RUN_OUTPUT | + | |
| - | void setup() { | + | void setup() {} |
| - | Serial.begin(115200); | + | |
| - | } | + | |
| void loop() { | void loop() { | ||
| - | const bool start = IdigitalRead(START_INPUT, | + | const bool inputOn |
| - | const bool reset = IdigitalRead(RESET_INPUT, | + | const bool outputOn |
| - | const bool ready = Iton(0, | + | digitalWrite(OUTPUT_PIN, outputOn |
| - | const bool stopDelay = Itof(1, ready, 500); // (Off Delay Timer) Return false after a set delay following the condition turning OFF. | + | |
| - | const bool startPulse = Itpl(2, ready, 200); // (Pulse Timer) Return true for the set duration from the instant the condition turns ON. | + | |
| - | const bool inspectionWindow = Itmon(3, startPulse, 3000); | + | |
| - | const bool batchDone = Itmr(4, ready, 10000, reset); | + | |
| - | const unsigned long elapsed = IgetTime(4); | + | |
| - | const bool savedDone = IgetState(4); | + | |
| - | + | ||
| - | digitalWrite(RUN_OUTPUT, stopDelay && !batchDone | + | |
| - | if (inspectionWindow && elapsed % 1000 < 20) { | + | |
| - | Serial.println(savedDone ? F(" | + | |
| - | } | + | |
| } | } | ||
| </ | </ | ||
| Line 44: | Line 32: | ||
| ===== Precautions ===== | ===== Precautions ===== | ||
| - | * Timer interrupt callbacks run inside an ISR. For safety, change only flags in the callback and perform actual control processing | + | * Call the timer command repeatedly |
| - | * Do not use slow or interrupt-dependent code such as '' | + | * Do not share a '' |
| - | * Normally, call '' | + | |
| - | * Do not use the default '' | + | ===== Built-in Commands in the Same Category ===== |
| - | * Explicitly using Timer1, Timer3, Timer4 or Timer5 may conflict with PWM, analog output or high-speed counter functions using that timer. | + | |
| - | * Configure only one '' | + | * [[: |
| - | * Defining an ISR for the same timer directly in the sketch may conflict with '' | + | * [[: |
| - | * '' | + | * [[:en-us_commands: |
| + | * [[: | ||
| [[: | [[: | ||
en-us_commands/reference/iton.1788791735.txt.gz · Last modified: by 127.0.0.1
