Table of Contents

PWMOFF()

PWMOFF() stops or re-enables PWM output on the specified pin.

PWMOFF command operation flow

void PWMOFF(uint8_t pin, bool POff)

Commands

Command Arguments Return Value Operation
PWMOFF(pin, POff) uint8_t pin
bool POff
void Stops or re-enables PWM output on the specified pin.

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.

const uint8_t PWM_PIN = 11;
 
void setup() {
  FDPWM(PWM_PIN, 1000, 50.0F);  // Start 1 kHz PWM at 50% duty on D11.
}
 
void loop() {
  const bool stopRequest = digitalRead(22) == HIGH;
  PWMOFF(PWM_PIN, stopRequest);  // Stop or allow D11 PWM according to D22.
  if (!stopRequest) FDPWM(PWM_PIN, 1000, 50.0F);  // Apply PWM settings again after allowing the output.
  delay(20);
}

Precautions

Built-in Commands in the Same Category

← Built-in Command List