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 |
|---|---|---|
|
|
PWM çıkışının bağlı olduğu 3 telli port, |
Ö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 Functionsvoid state(
int32_t value,
percentUnits units );
Parametre |
Tip |
Tanım |
|---|---|---|
|
|
PWM çıkışı için ayarlanacak yeni değer, -100 ile +100 yüzdesi arasındadır. |
|
|
PWM değerini temsil etmek için kullanılan birim: % |
Bu fonksiyon bir değer döndürmez.
NotesPWM çıkış değeri -100 ile +100 arasında değişir.
PWM çıkışı için geçerli tek birim %
percent.
// Set the PWM Output to 50%
pwm.state(50, percent);
// Set the PWM Output to -75%
pwm.state(-75, percent);