User Tools

Site Tools


en-us_commands:reference:wdt_disable

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en-us_commands:reference:wdt_disable [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1en-us_commands:reference:wdt_disable [2026/09/14 20:30] (current) – external edit 127.0.0.1
Line 14: Line 14:
  
 ===== Example ===== ===== Example =====
 +
 +This example uses MPINO-16A8R8T digital input D22. When D22 becomes HIGH, it disables the watchdog once and does not enable it again.
  
 <code cpp> <code cpp>
-WDT_DISABLE();+bool watchdogActive = true; 
 + 
 +void setup() { 
 +  WDT_ENABLE(WDT_2S);  // Start the two-second watchdog. 
 +
 + 
 +void loop() { 
 +  if (watchdogActive && digitalRead(22) == HIGH) { 
 +    WDT_DISABLE();  // Disable the watchdog when D22 becomes HIGH. 
 +    watchdogActive = false; 
 +  } 
 +  if (watchdogActive) WDT();  // Feed the watchdog only while it is active. 
 +  delay(100); 
 +}
 </code> </code>
  
Line 24: Line 39:
   * Do not set a timeout shorter than the longest normal processing time.   * Do not set a timeout shorter than the longest normal processing time.
   * Do not hide program faults by placing ''WDT()'' where it always executes unconditionally.   * Do not hide program faults by placing ''WDT()'' where it always executes unconditionally.
 +
 +===== Built-in Commands in the Same Category =====
 +
 +  * [[:en-us_commands:reference:wdt_enable|WDT_ENABLE() View detailed description]]
 +  * [[:en-us_commands:reference:wdt|WDT() View detailed description]]
  
 [[:en-us_commands:builtin|← Built-in Command List]] [[:en-us_commands:builtin|← Built-in Command List]]
  
en-us_commands/reference/wdt_disable.1788785569.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki