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


C++ LED类代码示例

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


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

示例1:

void
Frame::addLED(const LED& led)
{
  if (led.getLEDnr() >= 0 && led.getLEDnr() < m_nLEDs)
  {
    m_leds[led.getLEDnr()] = led;
  }
}
开发者ID:bartromgens,项目名称:ledstripstudio,代码行数:8,代码来源:frame.cpp

示例2: setup

void setup()
{
  // Start the watchdog ticks and push time events
  Watchdog::begin(16, SLEEP_MODE_IDLE, Watchdog::push_timeout_events);

  // Start the built-in LED in alert mode
  static LED builtin;
  builtin.alert_mode();
}
开发者ID:JJK801,项目名称:Cosa,代码行数:9,代码来源:main.cpp

示例3: console

Circuit::Circuit(Console *_console) : console(_console), terminals(1000),
    outLedList(IO_COUNT), usedInput(IO_COUNT, false), usedOutput(IO_COUNT, false)
{
    QList<QGraphicsItem *> items = console->items();

    Wire *wire;
    LED *led;
    IC *ic;
    int i, j;

    for (auto it = items.begin(); it != items.end(); it++)
    {
        if ((wire = dynamic_cast<Wire *>(*it)))
        {
            i = _console->getOffset(wire->line().p1());
            j = _console->getOffset(wire->line().p2());
            if (terminals.join(i, j))
            {
                connections.push_back(Connection(i, j));
                wire->markRedundent(false);
            }
            else
                wire->markRedundent(true);
            if (i >= OUTPUT_OFFSET)
                usedOutput[i-OUTPUT_OFFSET] = true;
            else if (i >= INPUT_OFFSET)
                usedInput[i-INPUT_OFFSET] = true;
            else if (j >= OUTPUT_OFFSET)
                usedOutput[j-OUTPUT_OFFSET] = true;
            else if (j >= INPUT_OFFSET)
                usedInput[j-INPUT_OFFSET] = true;
        }
        else if ((led = dynamic_cast<LED *>(*it)))
        {
            if (led->col >= 0 && led->col < 10)
                outLedList[led->col] = led;
            else
                ledList.push_back(led);
            led->switchOn(POWER);
        }
        else if ((ic = dynamic_cast<IC *>(*it)))
        {
            icList.push_back(ic);
        }
    }

    for (size_t i = 0; i < IO_COUNT; i++)
    {
        terminals.setstate(OUTPUT_OFFSET + i, State::undefined);
    }
    silentOutput = false;
#ifdef QT_DEBUG
    //terminals.print();
#endif
}
开发者ID:vinayak-garg,项目名称:dic-sim,代码行数:55,代码来源:circuit.cpp

示例4: LEDWhiteDim

bool State::LEDWhiteDim()
{
	bool State=led.WhiteDim();
	if (State==0)
		return 0;
	else
	{
		while(led.WhiteDim());
		return 1;
	}
}
开发者ID:RickorDD,项目名称:TRED,代码行数:11,代码来源:FSM.cpp

示例5:

////////////////////////
///两个灯一起闪烁n次
///@param 另一个灯的引用
///@param time 闪烁次数
///@param Interval 闪烁间隔(ms)
///////////////////////
void LED::Blink2(LED &led,uint8_t time,uint16_t interval)
{
	for(uint8_t i=0;i<time;++i)
	{
		On();
		led.On();
		TaskManager::DelayMs(interval);
		Off();
		led.Off();
		TaskManager::DelayMs(interval);
	}
}
开发者ID:InfiniteYuan1,项目名称:STM32,代码行数:18,代码来源:LED.cpp

示例6: launchChildProcess

int launchChildProcess(int processIndex, ChildProcess *childProcesses, int totalChildProcesses, LED &ledIndicator) {

    int status, waitTimeout = 0;
    pid_t childID, endID;
    time_t when;

    if ((childID = fork()) == -1) { // Start child process.
        perror("fork error");
        exit(EXIT_FAILURE);
    }
    else if (childID == 0) {    // The child process.
        exit(childProcesses[processIndex].func());
    }
    else // The parent process.
    {
        char *descr = childProcesses[processIndex].description;
        time(&when);
        printf("Parent process started at %s", ctime(&when));

        for(;;) { // Wait for child process to terminate.
            endID = waitpid(childID, &status, WNOHANG|WUNTRACED);

            if (endID == -1) // Error calling waitpid.
            {
                perror("waitpid error");
                exit(EXIT_FAILURE);
            }
            else if (endID == 0) // Child still running.
            {
                time(&when);
                printf("Waiting for %s at %s", descr, ctime(&when));
                waitTimeout++ % 2 == 0 ? ledIndicator.on() : ledIndicator.off();
                sleep(1);
            }
            else if (endID == childID) // Child ended.
            {
                if (WIFEXITED(status))
                    printf("%s ended normally. status: %d at %s\n", descr, status, ctime(&when));
                else if (WIFSIGNALED(status))
                    printf("%s ended because of an uncaught signal at %s.\n", descr, ctime(&when));
                else if (WIFSTOPPED(status))
                    printf("%s process has stopped at %s.\n", descr, ctime(&when));
                return status;
            }
        }
    }
    return 1;
}
开发者ID:vinceallenvince,项目名称:kittyCam,代码行数:48,代码来源:kittyLidar.cpp

示例7: if

/**
*  @brief
*    Called when a control of the input controller has been activated
*/
void Application30::OnControl(Control &cControl)
{
	// Get name of control
	String sControl = cControl.GetName();

	// Display control value
	String sValue;
	if (cControl.GetType() == ControlButton)
		sValue = static_cast<Button&>(cControl).IsPressed() ? "<pressed>" : "<released>";
	else if (cControl.GetType() == ControlAxis)
		sValue = String::Format("%5.2f", static_cast<Axis&>(cControl).GetValue());
	System::GetInstance()->GetConsole().Print("- '" + sControl + "': " + sValue + '\n');

	// LED test
	if ((cControl.GetName() == "Plus" || cControl.GetName() == "Minus") && static_cast<Button&>(cControl).IsPressed()) {
		// Get LED control
		LED *pLED = static_cast<LED*>(cControl.GetController()->GetControl("LED"));
		if (pLED) {
			// Change LED value
			uint32 nLED = pLED->GetLEDs();
			if (cControl.GetName() == "Plus")
				nLED++;
			else
				nLED--;
			if (nLED > 15)
				nLED = 0;
			pLED->SetLEDs(nLED);
		}
	}

	// Rumble test
	if (cControl.GetName() == "Button1" || cControl.GetName() == "Button2") {
		// Get rumble control (try "Rumble3" first for joystick, then "Rumble1" for WiiMote)
		Effect *pRumble = static_cast<Effect*>(cControl.GetController()->GetControl("Rumble3"));
		if (!pRumble)
			pRumble = static_cast<Effect*>(cControl.GetController()->GetControl("Rumble1"));
		if (pRumble) {
			// Enable or disable rumble?
			if (cControl.GetName() == "Button1")
				pRumble->SetValue(1.0f);
			if (cControl.GetName() == "Button2")
				pRumble->SetValue(0.0f);
		}
	}
}
开发者ID:Tank-D,项目名称:potential-octo-dubstep,代码行数:49,代码来源:Application30.cpp

示例8: drawObject

/******************************************************************************
 * @author Julian Brackins
 *
 * @par Description:
 * Convert integers to strings lmaoooo.
 *
 * @param[in] light - an led light being tracked
 * @param[in] frame - image matrix
 * 
 * @returns Set of coordinates in the Coord class structure, giving you (x,y)
 *
 *****************************************************************************/
Coord drawObject(LED light, Mat &frame)
{
  //Draw a circle around the object being tracked

  cv::circle( frame, cv::Point( light.getX(),light.getY() ), 10, cv::Scalar(0,0,255));
  cv::putText(frame, intToString( light.getX() ) + " , " + intToString( light.getY() ), 
  cv::Point(light.getX(), light.getY() + 20 ), 1, 1, cv::Scalar(0,255,0));
  Coord point;
  point.setX(light.getX());
  point.setY(light.getY());
  return point;
}
开发者ID:SDSMT-CSC464-F15,项目名称:landingpad,代码行数:24,代码来源:cv_tracker.cpp

示例9: 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

示例10: LEDGold

bool State::LEDGold()
{
	return led.GoldState();
}
开发者ID:RickorDD,项目名称:TRED,代码行数:4,代码来源:FSM.cpp

示例11: main

int main(void)
{
	SystemInit();
	TickTimer::Init();
	led.Init();
    while(1)
    {
    	led.On(led_all);
    	TickTimer::DelayMs(100);
    	led.Off(led_all);
    	TickTimer::DelayMs(200);
    }
}
开发者ID:bonzehan,项目名称:cppInterruptTest,代码行数:13,代码来源:main.cpp

示例12: main

/*Main Function*/
int main(void) {

	red_led.clear_led();
	blue_led.set_led();

	/*Configure SysTick to tick at every 200msec*/
	SysTick_Config(4800000);

	while(1)
	{
		/*Do nothing*/
	}
    return 0 ;
}
开发者ID:super-saiyan-god,项目名称:LPC812,代码行数:15,代码来源:LPC812.cpp

示例13: one2two

bool one2two() {
    bool pressed = button_pressed();
    if (pressed) {
        lcd.display();
        led.on();
        lcd.print("Counting!");
    }
    return pressed;
}
开发者ID:hithwen,项目名称:statemachine,代码行数:9,代码来源:lcdexample.cpp

示例14: setup

void setup() {
	Serial.begin(9600);
    lcd.begin(16, 2);
    led.on();
	machine.add_transition(0, 1, &button_pressed);
	machine.add_transition(1, 2, &one2two);
	machine.add_transition(2, 0, &button_pressed);
    machine.add_state_function(0, &hello);
    machine.add_state_function(1, &off);
    machine.add_state_function(2, &counting);
}
开发者ID:hithwen,项目名称:statemachine,代码行数:11,代码来源:lcdexample.cpp

示例15: setup

void setup()
{
	ebox_init();

	PPS_PIN.mode(OUTPUT_PP);
	pps_off();
	uart1.begin(115200);
	led.begin();
	btn.begin();
	date_time.begin(115200);

}
开发者ID:shentqlf,项目名称:SC-234,代码行数:12,代码来源:main.cpp


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