当前位置: 首页>>代码示例>>C++>>正文


C++ Led::on方法代码示例

本文整理汇总了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));
}
开发者ID:stejsoftware,项目名称:GarageControlFirmware,代码行数:51,代码来源:application.cpp

示例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;
					}
				}
			}
开发者ID:Alex0704t,项目名称:xpcc,代码行数:47,代码来源:double_indicator.hpp

示例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;
				}
			}
开发者ID:Alex0704t,项目名称:xpcc,代码行数:22,代码来源:pulse.hpp


注:本文中的Led::on方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。