en-us_commands:reference:pwmoff
This is an old revision of the document!
Table of Contents
PWMOFF()
Commands
| Command | Arguments | Return Value | Operation |
|---|---|---|---|
PWMOFF(pin, POff) | uint8_t pinbool POff | void | Stops or re-enables PWM output on the specified pin. |
Example
const uint8_t PWM_PIN = 11; void setup() { FDPWM(PWM_PIN, 1000, 50.0F); // Output PWM at the specified frequency and duty cycle. } 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. PWMOFF(PWM_PIN, emergencyStop); // Stop or re-enable PWM output on the specified pin. if (!emergencyStop) FDPWM(PWM_PIN, 1000, 50.0F); // Output PWM at the specified frequency and duty cycle. }
Precautions
- Check product-specific PWM pins and timer sharing.
- Changing frequency or resolution may also affect other channels on the same timer.
- Ensure the connected load is safe when stopping or resetting outputs.
Built-in Commands in the Same Category
en-us_commands/reference/pwmoff.1788796404.txt.gz · Last modified: by 127.0.0.1
