PWM Çıkışı#

giriiş#

pwm_out sınıfı, VEX V5 3-Wire portundaki PWM (Darbe Genişliği Modülasyonu) çıkışını kontrol etmek için kullanılır. Cihazların, uyumlu 3-Wire bileşenlerine değişken genişlikte darbe sinyalleri göndermesine olanak tanır.

Sınıf Oluşturucuları#

pwm_out(
  triport::port &port );

Sınıf Yıkıcısı#

pwm_out nesnesini yok eder ve ilişkili kaynakları serbest bırakır.

~pwm_out();

Parametreler#

Parametre

Tip

Tanım

port

triport::port &

PWM çıkışının bağlı olduğu 3 telli port, Brain.ThreeWirePort.X veya ExpanderName.Xşeklinde yazılır; burada X port harfidir (örneğin, Brain.ThreeWirePort.A veya Expander1.A).

Örnek#

// Create the pwm_out instance on 3-Wire Port A
pwm_out pwm = pwm_out(Brain.ThreeWirePort.A);

Üye Fonksiyonları#

pwm_out sınıfı aşağıdaki üye fonksiyonlarını içerir:

  • state — PWM çıkışının durumunu ayarlar.

Herhangi bir pwm_out üye fonksiyonunu çağırmadan önce, aşağıda gösterildiği gibi bir pwm_out örneği oluşturulmalıdır:

/* This constructor is required when using VS Code.
PWM configuration is generated automatically
in VEXcode using the Device Menu. Replace the values
as needed. */

// Create the pwm_out instance on 3-Wire Port A
pwm_out pwm = pwm_out(Brain.ThreeWirePort.A);

state#

PWM çıkışının durumunu belirtilen bir değere ayarlar.

Available Functions
void state(
  int32_t      value,
  percentUnits units );

Parameters

Parametre

Tip

Tanım

value

int32_t

PWM çıkışı için ayarlanacak yeni değer, -100 ile +100 yüzdesi arasındadır.

units

percentUnits

PWM değerini temsil etmek için kullanılan birim: % percent / pct.

Return Values

Bu fonksiyon bir değer döndürmez.

Notes
  • PWM çıkış değeri -100 ile +100 arasında değişir.

  • PWM çıkışı için geçerli tek birim % percent.

Examples
// Set the PWM Output to 50%
pwm.state(50, percent);

// Set the PWM Output to -75%
pwm.state(-75, percent);