本文整理汇总了C++中PWM类的典型用法代码示例。如果您正苦于以下问题:C++ PWM类的具体用法?C++ PWM怎么用?C++ PWM使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PWM类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void)
{
char dutyCycle;
UART uart;
PWM pwm;
uart.init();
uart.println("*** QC-BLCD OS Startup Sequence ***");
uart.println(" > UART initialized");
pwm.init();
uart.println(" > PWM initialized");
uart.println("Startup Sequence successfull!");
uart.println("Main program starts now");
dutyCycle=0;
while(42) {
/*itoa(dutyCycle,msg,10);
println(msg);*/
pwm.setDutyCycle(dutyCycle);
dutyCycle++;
_delay_ms(200);
}
}
示例2: main
int main()
{
PWM pwm;
LeftMotor left;
RightMotor right;
IM::init();
log::emit() << "Tick-Freq: " << PWM::TickFrequency::numerator << " / "
<< PWM::TickFrequency::denominator << log::endl;
log::emit() << "PWM-Freq: " << PWM::DutyFrequency::numerator << " / "
<< PWM::DutyFrequency::denominator << log::endl;
pwm.start();
left.state(LeftMotor::forward);
right.state(RightMotor::forward);
pwm.value<PWM::channelA>(512);
pwm.value<PWM::channelB>(256);
while(true)
Morpheus::sleep(Morpheus::SleepModes::idle);
return 0;
}
示例3: light_init
void LIGHT::light_init()
{
//pwm initialized outside
//PWM head(PWM::pwm1, 0); //PWM for head lights
//PWM tail(PWM::pwm2, 0); //PWM for tail lights
hl_mode=OFF;
data_rcv.headlights=true;
head.set(0);
tail.set(0);
}
示例4: defined
// FIXME: parity
void tape::write(uint8_t b) {
#if defined(PWM_DUTY)
pwm.set_duty(PWM_DUTY);
#endif
write_bit(0);
for (int i = 0; i < _data_bits; i++) {
write_bit(b & 1);
b >>= 1;
}
write_bit(1);
if (_stop_bits == 2)
write_bit(1);
pwm.set_duty(0);
}
示例5: setup
void setup()
{
ebox_init();
uart1.begin(9600);
PB8.mode(OUTPUT_PP);
p = 1;
ic.begin(p);//初始化输入捕获参数,p分频
ic.attch_ic_interrupt(mesure_frq);//绑定捕获中断事件函数
ic.attch_update_interrupt(update_event);
pwm1.begin(1,500);
pwm1.set_oc_polarity(1);
}
示例6: main
int main(void)
{
NVIC_Excitation();
pwm.init(&pwm);
adcdim.init(&adcdim);
// dacout.Output1 = 1000;
// dacout.init(&dacout);
spiout.init(&spiout);
for(;;);
}
示例7: PwmEnable15
void PwmEnable15(void)
{
pwm.Enable(7);
}
示例8: PwmEnable13
void PwmEnable13(void)
{
pwm.Enable(5);
}
示例9: PwmEnable12
void PwmEnable12(void)
{
pwm.Enable(4);
}
示例10: PwmSetPolarity16
void PwmSetPolarity16(BOOL Polarity)
{
pwm.SetPolarity(8,Polarity);
}
示例11: PwmSetPolarity14
void PwmSetPolarity14(BOOL Polarity)
{
pwm.SetPolarity(6,Polarity);
}
示例12: PwmSetPolarity12
void PwmSetPolarity12(BOOL Polarity)
{
pwm.SetPolarity(4,Polarity);
}
示例13: PwmSetDuty13
void PwmSetDuty13(U16 Duty)
{
pwm.SetDuty(5,Duty);
}
示例14: PwmSetDuty12
void PwmSetDuty12(U16 Duty)
{
pwm.SetDuty(4,Duty);
}
示例15: PwmSetDuty6
void PwmSetDuty6(U16 Duty)
{
pwm.SetDuty(3,Duty);
}