User Tools

Site Tools


en-us_commands:reference:pwmoff

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
en-us_commands:reference:pwmoff [2026/09/08 00:53] – 바깥 편집 127.0.0.1en-us_commands:reference:pwmoff [2026/09/14 20:30] (current) – external edit 127.0.0.1
Line 14: Line 14:
  
 ===== Example ===== ===== Example =====
 +
 +This example uses MPINO-16A8R8T PWM output D11 and digital input D22. HIGH on D22 stops PWM; LOW allows it again. This input demonstrates the function and does not replace an equipment emergency-stop device.
  
 <code cpp> <code cpp>
Line 19: Line 21:
  
 void setup() { void setup() {
-  FDPWM(PWM_PIN, 1000, 50.0F);  // Output PWM at the specified frequency and duty cycle.+  FDPWM(PWM_PIN, 1000, 50.0F);  // Start 1 kHz PWM at 50% duty on D11.
 } }
  
 void loop() { void loop() {
-  const bool emergencyStop IdigitalRead(0, 5);  // Read the input repeatedly and update only if all samples match. If HIGH and LOW are mixed, retain the previous stable state. +  const bool stopRequest digitalRead(22== HIGH
-  PWMOFF(PWM_PIN, emergencyStop);  // Stop or re-enable PWM output on the specified pin+  PWMOFF(PWM_PIN, stopRequest);  // Stop or allow D11 PWM according to D22
-  if (!emergencyStop) FDPWM(PWM_PIN, 1000, 50.0F);  // Output PWM at the specified frequency and duty cycle.+  if (!stopRequest) FDPWM(PWM_PIN, 1000, 50.0F);  // Apply PWM settings again after allowing the output. 
 +  delay(20);
 } }
 </code> </code>
en-us_commands/reference/pwmoff.1788796404.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki