本文整理汇总了C++中Led::on方法的典型用法代码示例。如果您正苦于以下问题:C++ Led::on方法的具体用法?C++ Led::on怎么用?C++ Led::on使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Led
的用法示例。
在下文中一共展示了Led::on方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onDoorStatus
void onDoorStatus()
{
debug("onDoorStatus()");
door_status = (DS) cmd.readInt32Arg();
cmd.sendCmd(GC_Acknowledge, F("door"));
if( ((door_command == DC_OPEN_DOOR) && (door_status == DS_Open )) || // door is now open
((door_command == DC_CLOSE_DOOR) && (door_status == DS_Closed)) || // door is now closed
(door_command == DC_NONE) )
{
door_command = DC_NONE;
movementWatchdog.stop();
switch( door_status )
{
case DS_Open:
openLed.on();
closeLed.off();
break;
case DS_Closed:
closeLed.on();
openLed.off();
break;
}
}
else
{
switch( door_command )
{
case DC_OPEN_DOOR:
breathe(openLed);
closeLed.off();
break;
case DC_CLOSE_DOOR:
breathe(closeLed);
openLed.off();
break;
}
}
updateDisplay();
Particle.publish(F("Door"), toString(door_status), PRIVATE);
//lcdPrint(0, toString(door_status));
//lcdPrint(1, toString(door_command));
}
示例2:
/// Must be called at least every ms
void
run()
{
led->run();
if (timer.isExpired() && (isBlinking || state == FIRST_BREAK || state == SECOND_BREAK))
{
switch (state)
{
case FIRST_FLASH:
led->on(onFade);
timer.restart(on1);
state = FIRST_BREAK;
break;
case FIRST_BREAK:
led->off(offFade);
timer.restart(pause1);
state = SECOND_FLASH;
break;
case SECOND_FLASH:
led->on(onFade);
if (isCounting && !--counter) {
isBlinking = false;
isCounting = false;
}
timer.restart(on2);
state = SECOND_BREAK;
break;
case SECOND_BREAK:
led->off(offFade);
timer.restart(pause2);
default:
state = FIRST_FLASH;
break;
}
}
}
示例3:
/// Must be called at least every ms
void
run()
{
led->run();
if (!led->isFading() && (isPulsing || !pulseDirection))
{
if (pulseDirection) {
led->on(halfPeriod);
if (isCounting && !--counter) {
isPulsing = false;
isCounting = false;
}
}
else {
led->off(halfPeriod);
}
pulseDirection = !pulseDirection;
}
}