/** D E C L A R A T I O N S **************************************************/ void main(void) { InitRobot(); for (;;) { UINT32_VAL sensors; sensors.Val = 0; // char command; // // sensors = processSensor(); // if (sensors) { // switch (sensors) { // case 24: // command = FORWARD; // break; // case 82: // command = REVERSE; // break; // case 90: // command = RIGHT; // break; // case 8: // command = LEFT; // break; // case 28: // command = HALT; // break; // default: // command = HALT; // break; // } // putch(command); // moveRobot(command); // } sendIR(0xE718FF00); sensors = processSensor(); printf("0x%X\r\n",sensors.word.HW); Delay10KTCYx(200); //__delay_ms(5); // mLED_1_Toggle(); // Delay10KTCYx(200); // Delay10KTCYx(200); // Delay10KTCYx(200); } }
/*============================= void mainLoop inputs: none returns: n/a Creates a loop while health > 0 that first checks to see if mana is above zero, then if it is not it calls coolDownMode(), otherwise it polls the bowNocked method to check for user input. If bowNocked is TRUE, get the drawStrength in a local uint8_t by calling drawStrength(), and calls sendIR() using the drawStrength variable. Written by: Katie Hobble =================================*/ void mainLoop() { //Create an infinite loop to run while the bow is in use while(health > 0) { //First, check to see if mana is less than 0. If it is, enter //cool down mode to replenish mana if(mana <= 0) { //Mana needs to be replenished, enter cool down mode. coolDownMode(); }//end if //We get here only if mana is at an acceptable amount. //Poll the bowNocked method to see if there has been any user input if(bowNocked()) { //Play the bow nocked sound playAudio(soundInput, 0); //User input was detected by bowNocked() method. Call the //drawStrength() method to get the draw strength of the user's //shot in the form of a uint8_t int drawStrength = measureDrawStrength(); //Pass the uint8_t drawStrength to the sendIR method if its greater than 0 if(drawStrength > 0) { //Display the bow's firing power LCDdisplay(fire,drawStrength); //Send the damage packets sendIR(drawStrength); }//end if }//end if }//end while //Health is less than zero, send out some stun packets through PC3 (short range) for(int i = 0; i < 5; i++) { //Send the start envelope FiveSixK(10, 0x08); //Send the first stun data envelpe FiveSixK(40, 0x08); //Repeat the stun data envelope FiveSixK(40, 0x08); //Send stop envelope FiveSixK(150, 0x08); //Delay a little bit _delay_ms(50); }//end for }//end mainLoop
VCRGroup::VCRGroup(QWidget *parent, const char *name) : QWidget(parent, name) { QVBoxLayout *vlayout = new QVBoxLayout(this); QHBoxLayout *hlayout1 = new QHBoxLayout(this); QHBoxLayout *hlayout2 = new QHBoxLayout(this); vlayout->addLayout(hlayout1); vlayout->addSpacing(1); vlayout->addLayout(hlayout2); QPushButton *play = new QPushButton("Play",this, "play"); hlayout1->addWidget(play); connect(play, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); hlayout1->addSpacing(5); QPushButton *pause = new QPushButton("Pause",this, "pause"); hlayout1->addWidget(pause); connect(pause, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); hlayout1->addSpacing(5); QPushButton *stop = new QPushButton("Stop",this, "stop"); hlayout1->addWidget(stop); connect(stop, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); hlayout1->addSpacing(5); QPushButton *record = new QPushButton("Record",this, "record"); hlayout1->addWidget(record); connect(record, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); QPushButton *back = new QPushButton("Back",this, "back"); hlayout2->addWidget(back); connect(back, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); hlayout2->addSpacing(5); QPushButton *rewind = new QPushButton("Rewind",this, "rewind"); hlayout2->addWidget(rewind); connect(rewind, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); hlayout2->addSpacing(5); QPushButton *ff = new QPushButton("FF",this, "ff"); hlayout2->addWidget(ff); connect(ff, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); hlayout2->addSpacing(5); QPushButton *next = new QPushButton("Next",this, "next"); hlayout2->addWidget(next); connect(next, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); }