本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}
示例5: OrangeLight
// this function lights the orange light only
void OrangeLight() {
ledGreen.SwitchOff();
ledOrange.SwitchOn();
ledRed.SwitchOff();
}