en-us_commands:reference:igetstate
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| en-us_commands:reference:igetstate [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1 | en-us_commands:reference:igetstate [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> | ||
| - | bool Iton(uint8_t | + | const uint8_t |
| - | bool Itof(uint8_t | + | const uint8_t |
| - | bool Itpl(uint8_t timer_id, bool state, unsigned long delayTime); | + | |
| - | bool Itmon(uint8_t timer_id, bool state, unsigned long delayTime); | + | void setup() {} |
| - | bool Itmr(uint8_t timer_id, bool state, unsigned long delayTime, bool reset = false); | + | |
| - | unsigned long IgetTime(uint8_t timer_id); | + | void loop() { |
| - | bool IgetState(uint8_t timer_id); | + | const bool inputOn = digitalRead(INPUT_PIN) == HIGH; |
| + | Iton(0, inputOn, 1000); // Update the timer in every loop before reading its state. | ||
| + | const bool done = IgetState(0); // Read the output state of the timer with the same ID. | ||
| + | | ||
| + | } | ||
| </ | </ | ||
| ===== 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 '' | + | * Call the timer with the same ID first. An ID that has not been created returns false. |
| - | * Do not use the default '' | + | |
| - | * Explicitly using Timer1, Timer3, Timer4 or Timer5 may conflict with PWM, analog output or high-speed counter functions using that timer. | + | ===== Built-in Commands |
| - | * Configure only one '' | + | |
| - | * Defining an ISR for the same timer directly | + | * [[: |
| - | * '' | + | |
| [[: | [[: | ||
en-us_commands/reference/igetstate.1788785567.txt.gz · Last modified: by 127.0.0.1
