User Tools

Site Tools


en-us_commands:reference:pwm

This is an old revision of the document!


Table of Contents

PWM()

PWM() outputs 8-bit or 16-bit PWM on the specified pin.

PWM command operation flow

void PWM(uint8_t pin, uint16_t val, bool onDutybit16 = false)

Commands

Command Arguments Return Value Operation
PWM(pin, val, onDutybit16) uint8_t pin
uint16_t val
bool onDutybit16 = false
void Outputs 8-bit or 16-bit PWM on the specified pin.

Example

PWM(21, 32768, true);  // Example: when D21 is exposed as PWM on the board

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 Command List

en-us_commands/reference/pwm.1788785569.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki