This command will enable and disable PWM pins and will set their duty cycle and frequency to the desired values. The default queue for this command is the high priority queue. If the queue parameter is set to 0, then the command will be submitted to the normal priority queue. In response to this command, the state of all PWM pins will be returned.
Key, value pairs
Key
Value
Required
Description
"cmd"
"pwm"
Yes
Enable or disable PWM pins and sets their duty cycle and frequency values.
"id"
Int (>0)
No
Id can be any positive integer. If id is not provided, status of the command will not be returned from the controller.
"pwm0", "pwm1", "pwm2", "pwm3", "pwm4"
0 / 1
No
If pwmi is set to 0, it will disable ith PWM pin. If pwmi is set to 1, it will enable ith PWM pin. If pwmi is not present as a key, state of ith PWM pin will not change by the command.
"duty0", "duty1", "duty2", "duty3", "duty4"
Double (>=0 and <=100)
No
If dutyi is present as a key, duty cycle of the ith PWM will be set to its value which is the percentage of the period that the PWM pin will be on.
"freq0", "freq1", "freq", "freq3", "freq4"
Double (>=0 and <=120,000,000)
No
If freqi is present as a key, frequency of the ith PWM pin will be set to its value.
"queue"
0 / 1
No
If the value is 0, the command will be submitted to the normal priority queue. Otherwise, it will be submitted to the high priority queue. The default value 1.
Response
Key
Value
Description
"cmd"
"pwm"
In response to pwm command, a message is returned with cmd field set to pwm where the state, duty cycle and frequency of all PWM pins are included in it.
"id"
Int (>0)
Same id as the original command.
"pwm0", "pwm1", "pwm2", "pwm3", "pwm4"
0 / 1
Indicates if each PWM pin is enabled or disabled. 1 means the PWM pin is enabled and 0 means it is diabled.