本文整理汇总了C++中Led类的典型用法代码示例。如果您正苦于以下问题:C++ Led类的具体用法?C++ Led怎么用?C++ Led使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Led类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InputButton
void TestSimulationController::testCase1( ) {
InputButton *btn1 = new InputButton( );
InputButton *btn2 = new InputButton( );
And *andItem = new And( );
Led *led = new Led( );
QNEConnection *conn = new QNEConnection( );
QNEConnection *conn2 = new QNEConnection( );
QNEConnection *conn3 = new QNEConnection( );
editor->getScene( )->addItem( led );
editor->getScene( )->addItem( andItem );
editor->getScene( )->addItem( btn1 );
editor->getScene( )->addItem( btn2 );
editor->getScene( )->addItem( conn );
editor->getScene( )->addItem( conn2 );
editor->getScene( )->addItem( conn3 );
conn->setPort1( btn1->output( ) );
conn->setPort2( andItem->input( 0 ) );
conn2->setPort1( btn2->output( ) );
conn2->setPort2( andItem->input( 1 ) );
conn3->setPort1( andItem->output( ) );
conn3->setPort2( led->input( ) );
QVector< GraphicElement* > elms( SimulationController::sortElements( editor->getScene( )->getElements( ) ) );
QVERIFY( elms.at( 0 ) == btn1 || elms.at( 1 ) == btn1 );
QVERIFY( elms.at( 0 ) == btn2 || elms.at( 1 ) == btn2 );
QVERIFY( elms.at( 2 ) == andItem );
QVERIFY( elms.at( 3 ) == led );
}
示例2: qDebug
QList<QVector3D> ControlPlan2D::controlLed(const QString & valeur,Cube cubeMotif,int NumeroPlan,QList<QVector3D> liste_vecteur3D,Ui::MainWindow *ui,QPushButton* buttons[90]){
QString strlig=valeur[0];
QString strcol=valeur[1];
int lig=strlig.toInt(0,10);
int col=strcol.toInt(0,10);
Led l;
l=cubeMotif.getList1()->value(NumeroPlan).getLed(lig,col);
l.modifierEtat();
Plan p1=cubeMotif.getList1()->value(NumeroPlan);
p1.updatePlan(l,lig,col);
cubeMotif.updateCube(p1,NumeroPlan);
QVector3D v;
v=QVector3D(abs(8-col),NumeroPlan,abs(8-lig));
liste_vecteur3D.append(v);
QString s ;
s=QString::number(liste_vecteur3D.size());
qDebug()<<"la taille de la liste est "+s;
ui->widget->setListPoints(liste_vecteur3D);
if(cubeMotif.getList1()->value(NumeroPlan).getLed(lig,col).getEtat()==1){
liste_vecteur3D.append(v);
ui->widget->setListPoints(liste_vecteur3D);
}
else {
liste_vecteur3D.removeAll(v);
ui->widget->setListPoints(liste_vecteur3D);
}
afficheLed(buttons,lig,col,l.getEtat());
return liste_vecteur3D;
}
示例3: initLeds
void
initLeds()
{
redLed.off();
greenLed.off();
redLed.quicklyMakeBlinkSeveralTimes(3);
}
示例4: drawLedCircleOnStatusImage
void VideoBasedTracker::drawLedCircleOnStatusImage(Led const &led,
bool filled,
cv::Vec3b color) {
cv::circle(m_statusImage, led.getLocation(),
led.getMeasurement().diameter / 2., cv::Scalar(color),
filled ? -1 : 1);
}
示例5: ledSet
void Wrapper::ledSet(WbDeviceTag tag, int state) {
Device *device = DeviceManager::instance()->findDeviceFromTag(tag);
Led *led = dynamic_cast<Led *>(device);
if (led) {
led->setLedRequested();
led->setState(state);
}
}
示例6: rt_thread_entry_led_test
void rt_thread_entry_led_test(void* parameter)
{
Led led;
led.init();
while(1)
{
led.toggle();
rt_thread_delay(RT_TICK_PER_SECOND/5);
}
}
示例7: Led
void LedTests::addTimeAxis() {
iAnimation->addTimeAxis(0, 100, 100, kPriorityLow, false);
Led* led = new Led(iAnimation,
*iAnimation,
1,
Position(0,0),
NULL);
led->addTimeAxis();
QVERIFY(led->timeAxis() != NULL);
}
示例8: setup
// Setup function
void setup()
{
// connection to the salve computer in the garage
Serial1.begin(9600);
// register Particle variables
Particle.variable("rssi", rssi);
Particle.variable("temperature", temperature);
Particle.variable("humidity", humidity);
// register Particle functions
Particle.function("Door", funcDoor);
Particle.function("Restart", funcRestart);
// connect to the blynk server
//Blynk.begin("7cb12eb10dee49f98c61d3e7b34f7433");
//while (Blynk.connect() == false) {
// Wait until connected
//}
debug("STEJ Garage Control");
debug(String::format("Built: %s %s",__DATE__, __TIME__));
closeLed.setMax(brightness);
openLed.setMax(brightness);
openButton.attach(bePressed, onOpenPressed);
closeButton.attach(bePressed, onClosePressed);
screen.begin(0x73, true);
screen.setBrightness((brightness / 100.0) * 15);
screen.clearText();
screen << "Now is the time for a very long message to see if it works!";
//lcd.clear();
// Adds newline to every command
cmd.printLfCr();
cmd.attach(GC_DoorStatus, &onDoorStatus);
cmd.attach(GC_Temperature, &onTemperature);
cmd.sendCmd(GC_Acknowledge, F("Garage Control Master Started!"));
onFiveSeconds(); fiveSecondTimer.start();
fiveMinuteTimer.start();
onThirtySeconds(); thirtySecondTimer.start();
}
示例9: breathe
void breathe(Led & led)
{
if( !led.isRunning() )
{
if( led.isOn() )
{
led.fadeOff(breathe);
}
else
{
led.fadeOn(breathe);
}
}
}
示例10: switch
bool Chirp::overlaps(Led led) {
float maxMoveDistance = lastSeen * Config::getRobotSpeed();
float maxRotation = lastSeen * Config::getRobotRotation();
float distance = util::distance(position, led.getPoint());
switch(led.getType()) {
case Led::RED:
return distance + maxMoveDistance < Config::getRobotDiameter();
case Led::BLUE:
return distance + maxMoveDistance < Config::getRobotDiameter() / 2 + Config::getCameraLedSize();
case Led::GREEN:
return distance + maxMoveDistance < (1/2.0 + 1.0/4.0) * Config::getRobotDiameter();
}
}
示例11: stopActuators
void Wrapper::stopActuators() {
// reset all the requests
for (int i=0; i<5; i++) {
Led *led = DeviceManager::instance()->led(i);
led->resetLedRequested();
}
vector<Device *>::const_iterator it;
const vector<Device *> &devices = DeviceManager::instance()->devices();
for (it=devices.begin() ; it < devices.end(); it++) {
Sensor *s = dynamic_cast<Sensor *>(*it);
if (s)
s->resetSensorRequested();
}
// send the packet
robotStep(0);
}
示例12: loop
// Loop function
void loop()
{
// process serial commands
cmd.feedinSerialData();
// read buttons
openButton.run();
closeButton.run();
// update led matrix
screen.run(mpScrollLeft, 100);
// update leds
closeLed.display();
openLed.display();
// update blynk
//Blynk.run();
}
示例13: QFETCH
void LedTests::constructor() {
QFETCH(Position, position);
QFETCH(int, number);
QFETCH(QString, error);
try {
Led* led = new Led(iAnimation,
*iAnimation,
number,
position,
NULL);
QCOMPARE(led->position(), position);
QCOMPARE(led->number(), number);
} catch(IllegalArgumentException& e){
QCOMPARE(e.errorMessage(), error);
return;
}
}
示例14: main
int main(int argc, char** argv){
//Definir estados Leds:
LedRed.LedOff(); //OK
LedGreen.LedOff(); //OK
//Asignar interrupciones a teclas
Tecla1.teclaInterrupcion(); //OK
Tecla3.teclaInterrupcion(); //OK
//Configurar interrupciones:
INTCONSET= _INTCON_MVEC_MASK; //CONFIGURE INTERRUPT CONTROLLLER FOR MULTIVECTOR
__asm__ volatile("ei"); //ENABLE INTERRUPTS
//Main program:
while(1){
if(Tecla1.pulsada()== 1){
LedRed.LedOn();
}
//PULSAR TECLA 2(RB12) -> APAGAR LOS DOS
if(Tecla2.pulsada_ahora() == 1){ //DOESNT WORKS
LedGreen.LedOn();
}
//PULSAR TECLA 3(RB14) -> ENCENDER LED ROJO(RB4) //OK
if(Tecla3.pulsada()== 1){
LedRed.LedOff();
LedGreen.LedOff();
}
}
return 0;
}
示例15: IllegalArgumentException
void AxisDetailsWidget::addLed(int row, int column) {
Led* led = iAnimation.ledAt(Position(row, column));
if(led == NULL) {
throw IllegalArgumentException("AnimationDetailsWidget::addLed : NULL led");
}
if(!iLedDetails.contains(led->number())) {
int count = iLedDetails.count();
qDebug("add new led, %d, %d", row, column);
QLabel* ledNumberLabel = new QLabel(this);
ledNumberLabel->setMaximumWidth(LED_LABEL_WIDTH);
ledNumberLabel->setMinimumWidth(LED_LABEL_WIDTH);
FrameListWidget* framesListWidget = new FrameListWidget(this, axisData(*led), *this);//, count);
QToolButton* closeButton = new QToolButton(this);
closeButton->setObjectName(QString::fromUtf8("detailsClose"));
closeButton->setIcon(QIcon(":/images/delete.png"));
iGridLayout->addWidget(closeButton, count, 0);
iGridLayout->addWidget(ledNumberLabel, count, 1);
iGridLayout->addWidget(framesListWidget, count, 2);
// iGridLayout->setColumnStretch(1, 1);
// iGridLayout->addWidget(new QWidget(), count, 3);
// iGridLayout->setColumnStretch(3, 2);
iLedDetails.insert(led->number(), new LedDetails(*this,
*led,
*ledNumberLabel,
*framesListWidget,
*closeButton));
iCloseAll->setEnabled(true);
iScrollAreaWidgetContents->setShowCurrentFrameLine(true);
doResize();
layout()->invalidate();
}
}