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


C++ LED::SwitchOff方法代码示例

本文整理汇总了C++中LED::SwitchOff方法的典型用法代码示例。如果您正苦于以下问题:C++ LED::SwitchOff方法的具体用法?C++ LED::SwitchOff怎么用?C++ LED::SwitchOff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LED的用法示例。


在下文中一共展示了LED::SwitchOff方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UpdateWithLightTransition

 // this function simulates normal light condition when called at every loop
 // it automatically transitions from green to red signal by using the OrangeTransitionCounter
 void UpdateWithLightTransition(bool goSignal, bool turnLight, bool pedLight, int orangeLightTime) {
 
     // if green or go signal turn off transitioning process 
     // and only light up the green light
     if (goSignal) {
         transitionState = 0;
         GreenLight();
     }
     
     // if red signal and green light was previously on
     // start transitioning to red by firt turning on the 
     // orange light
     else if(!goSignal && ledGreen.IsOn() && transitionState == 0) {
         OrangeLight();
         transitionState = 1;
         OrangeTransitionCounter.Reset();
     } 
     // if red signal and greenlight was not on, directly
     // switch on the red light
     else if(!goSignal && !ledGreen.IsOn() && transitionState == 0)
         RedLight();
     
     // check if we are still transitioning to red light
     // if orangeTransitionCounter has passed orangeLightTime interval 
     // turn on the Red light only
     if (transitionState == 1) {
         if (OrangeTransitionCounter.GetCounter() < orangeLightTime)
             OrangeLight();
         else
             transitionState = 2;
     }
     
     if (transitionState == 2)
         RedLight();
         
     if (turnLight)
         ledFilterTurn.SwitchOn();
     else
         ledFilterTurn.SwitchOff();
     
     // ped lights turn on only when the normal lights are in red signal
     if (pedLight && ledRed.IsOn())
         ledPed.SwitchOn();
     else
         ledPed.SwitchOff();
 }
开发者ID:Swoorup,项目名称:ardu-trafficlight,代码行数:48,代码来源:trafficlightsystem.cpp

示例2: SetPins

 void SetPins(int pinGreenLED, int pinOrangeLED, int pinRedLED, int pinFilterTurnLED, int pinPedLED, int pinBuzzer) {
     ledGreen.SetPin(pinGreenLED);
     ledGreen.SwitchOff();
     
     ledOrange.SetPin(pinOrangeLED);
     ledOrange.SwitchOff();
     
     ledRed.SetPin(pinRedLED);
     ledRed.SwitchOff();
     
     ledFilterTurn.SetPin(pinFilterTurnLED);
     ledFilterTurn.SwitchOff();
     
     ledPed.SetPin(pinPedLED);
     ledPed.SwitchOff();
     
     crossingBuzzer.SetPin(pinBuzzer);
     crossingBuzzer.SetFrequency(BUZZER_FREQ);
     crossingBuzzer.TurnOffAlarm();
 }
开发者ID:Swoorup,项目名称:ardu-trafficlight,代码行数:20,代码来源:trafficlightsystem.cpp

示例3: RoadWorkLightOnly

 // this function lights the orange light only switching off
 // the turn and the ped light as well
 void RoadWorkLightOnly(){
     OrangeLight();
     ledPed.SwitchOff();
     ledFilterTurn.SwitchOff();
 }
开发者ID:Swoorup,项目名称:ardu-trafficlight,代码行数:7,代码来源:trafficlightsystem.cpp

示例4: EmergencyLightOnly

 // this function lights emergency light only switching off
 // the turn and the ped lights as well
 void EmergencyLightOnly() {
     RedLight();
     ledPed.SwitchOff();
     ledFilterTurn.SwitchOff();
 }
开发者ID:Swoorup,项目名称:ardu-trafficlight,代码行数:7,代码来源:trafficlightsystem.cpp

示例5: OrangeLight

 // this function lights the orange light only
 void OrangeLight() {
     ledGreen.SwitchOff();
     ledOrange.SwitchOn();
     ledRed.SwitchOff();
 }
开发者ID:Swoorup,项目名称:ardu-trafficlight,代码行数:6,代码来源:trafficlightsystem.cpp


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