top of page

PWM Commands

lpwc - List the PWM system channel allocations

Purpose

List the PWM channel allocations on the esp32. The esp32 can handle a maximum of 6 pwm chans.


Syntax

lpwc




lpwi - List the PWM system settings info

Purpose Display the settings being used by the PWM system.

Syntax lpwi

mfreq - Set PWM freq for the Drive Motors

Purpose

This sets the pwm frequency for the main drive motors. NOTE: the updated freq gets picked up by the relevant functions.


Syntax

mfreq freq


Arguments

freq

The frequency to use for the pwm main drive system. 50 to 5000Hz.



pfreq - Set PWM freq for the I/O Ports

Purpose

This sets the pwm freq for the pwm command.


Syntax

pfreq freq


Arguments

freq

The frequency to use for the pwm system. 50 to 5000Hz.



pwm - Pulse width modulation on a pin

Purpose

pwm allows a pulse width modulated (PWM) signal to be applied to a pin.


Syntax

pwm #~ duty


Arguments

#~

The port letter a, b, c, d and pin number 1 to 5. eg a1 or c4

duty The duty cycle from 0 to 100. Pushers No Returns Nothing

Examples pwm a1 50 Set pin a1 at 50% pwm d1 75 Set the USER LED at 75% brightness pwm a3 /speed Use the /speed variable to set the pwm duty on pin a3

bottom of page