脉冲宽度调制(PWM)#
介绍#
脉冲宽度调制 (PWM) 通过 3 线端口输出定时脉冲信号,使 V5 主控器能够通过每 16 毫秒 (ms) 改变脉冲宽度(占空比)来控制传统的电机控制器或伺服电机。
Note: Pwm objects generate a raw RC-style PWM waveform:
0% 输出产生 1.5 毫秒的脉冲。
100% 输出产生 2.0 毫秒的脉冲。
-100% 输出产生 1.0 毫秒的脉冲。
This page uses pwm_a as the example PWM output’s name. Replace it with your own configured name as needed.
以下是可用方法列表:
构造函数 – 手动初始化和配置 PWM 输出。
Pwm– Create a PWM output.
价值#
value returns the PWM output’s value from -100 to 100 as a percent.
Usage:
pwm_a.value()
参数 |
描述 |
|---|---|
此方法没有参数。 |
状态#
state sets the state of the PWM output as a percent.
Usage:
pwm_a.state(value)
参数 |
描述 |
|---|---|
|
PWM 输出值设置范围为 -100 到 100。 |
构造函数#
Constructors are used to create Pwm objects, which are necessary for configuring a PWM output.
Pwm#
Pwm creates a PWM output.
Usage:
Pwm(port)
范围 |
描述 |
|---|---|
|
The 3-Wire Port that the PWM output is connected to:
|
# Create a PWM output in Port A
pwm_a = Pwm(brain.three_wire_port.a)