void main() { DDRA = 0x02; DDRB = 0x04; DDRC = 0X08; DDRD = 0X16; while(1){ PORTA = 0x02; Delay_ms(1000); allOff(); Delay_ms(500); PORTB = 0x04; Delay_ms(1000); allOff(); Delay_ms(500); PORTC = 0x08; Delay_ms(1000); allOff(); Delay_ms(500); PORTD = 0x16; Delay_ms(1000); allOff(); Delay_ms(500); } }
void drawCrossed() { // // Seqeuentially turns on all the LEDs in a row with a brief delay between each // for (int i = 0; i <= 7; ++i) { allOff(); SensorValue[LED1 + i] = 1; SensorValue[LED1 + (7 - i)] = 1; if (i == 3) i += 2; wait1Msec(75); } for (int i = 1; i <= 7; ++i) { allOff(); SensorValue[LED1 + i] = 1; SensorValue[LED1 + (7 - i)] = 1; if (i == 3) i += 2; wait1Msec(75); } }
//////////////////////////////////////////////////////////////////////////////// // Checks the LED state variable and performs current led pattern // 0 Off, 1 Rain; 2 Light Rain, 3 Forgotten void LED::continueState(){ // If the led state has changed turn off all // lights prior to lighting the new pattern if(ledState != lastState){ // changedLocation(); allOff(); } switch (ledState){ // case 0: allOff(); break; case 1: lightRain(); break; case 2: rain(); break; case 3: heavyRain(); //Change to Heavy rain, will need to create that function break; case 4: forgotten(); break; } // Save the last state of the led lastState = ledState; }
static void heat_iteration(struct brew_task *bt) { int ii = 0; display_status(); // kick off reading the temp vTaskEnterCritical(); DS1820Init(); DS1820Skip(); DS1820Convert(); vTaskExitCritical(); // 1 second delay, run heat according to the duty cycle for (ii = 0; ii < 100; ii++) { if (ds1820_get_temperature() < heat_target && ii <= heat_duty_cycle && level_hit_heat() == 1) // check the element is covered { outputOn(SSR); } else { heat_target_reached = test_had_reached_target(); allOff(); } vTaskDelay(10); // wait for the conversion to happen } vTaskEnterCritical(); DS1820ReadTemp(); vTaskExitCritical(); heat_keep_temperature(); }
int main() { // Setup wiringPi if (wiringPiSetup() == -1) { exit(1); } // Register signal handler signal(SIGINT, signalHandler); // Setup all the pins to use OUTPUT mode setPinModes(OUTPUT); allOff(); // Open a midi port, connect to through port also midi_open(); // Process events forever while (true) { midi_process(midi_read()); } return -1; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { //setup hardware init(); // setzen der varibalen für bus in mainconfig //create UI ui->setupUi(this); //timer for clock timer_clock = new QTimer(this); connect(timer_clock, SIGNAL(timeout()), this, SLOT(time_update())); timer_clock->start(1000);//check every second for new time //initial reading time_update(); //start main threads sThread = new steuerungThreadLicht(this); mThread = new ModelThreadLicht(this); Ueberwachung = new thread_Ueberwachung(this, sThread); sThread->start(); mThread->start(); Ueberwachung->start(); //communication ui->sThread connect(this, SIGNAL(allOff()), sThread, SLOT(allOFF())); connect(this, SIGNAL(TeenkreisLichtOn()), sThread, SLOT(teenLichtOn())); connect(this, SIGNAL(JugendLichtOn()), sThread, SLOT(jugendLichtON())); }
GuiEditBoundaryConditions::GuiEditBoundaryConditions() { connect(m_Ui.pushButtonAdd, SIGNAL(clicked()), this, SLOT(addVol())); connect(m_Ui.pushButtonDelete, SIGNAL(clicked()), this, SLOT(delVol())); connect(m_Ui.pushButtonAddBoundaryType, SIGNAL(clicked()), this, SLOT(addBoundaryType())); connect(m_Ui.pushButtonDeleteBoundaryType, SIGNAL(clicked()), this, SLOT(deleteBoundaryType())); connect(m_Ui.listWidgetBoundaryType, SIGNAL(itemSelectionChanged()), this, SLOT(changePhysicalValues())); connect(m_Ui.pushButton_AddProcess, SIGNAL(clicked()), this, SLOT(addProcess())); connect(m_Ui.pushButton_RemoveProcess, SIGNAL(clicked()), this, SLOT(deleteProcess())); connect(m_Ui.pushButton_ImportHostFile, SIGNAL(clicked()), this, SLOT(importHostFile())); connect(m_Ui.pushButton_ExportHostFile, SIGNAL(clicked()), this, SLOT(exportHostFile())); connect(m_Ui.pushButtonAllA, SIGNAL(clicked()), this, SLOT(allA())); connect(m_Ui.pushButtonAllB, SIGNAL(clicked()), this, SLOT(allB())); connect(m_Ui.pushButtonAllOff, SIGNAL(clicked()), this, SLOT(allOff())); setupSolvers(); loadMpiParameters(); m_BcMap = NULL; delegate = new GuiVolumeDelegate(); delegate->setFirstCol(3); //set initial tab m_Ui.tabWidget->setCurrentIndex(0); }
void midi_process(snd_seq_event_t *ev) { // If this event is a PGMCHANGE type, it's a request to map a channel to an instrument if (ev->type == SND_SEQ_EVENT_PGMCHANGE) { //printf("PGMCHANGE: channel %2d, %5d, %5d\n", ev->data.control.channel, ev->data.control.param, ev->data.control.value); // Clear pins state, this is probably the beginning of a new song allOff(); } // If the event is SND_SEQ_EVENT_BOUNCE, then maybe this is an interrupt? if (ev->type == SND_SEQ_EVENT_BOUNCE) { allOff(); } if (channelActive == ev->data.control.channel) { // Note on/off event if (ev->type == SND_SEQ_EVENT_NOTEON) { // When pinActive is -1, we're playing the first note if (-1 == pinActive) { pinActive = 0; } else { // First turn off the current pin printf("Turning off pin %d\n", pinActive); pinOff(pinActive); // Increment pinActive printf("Incrementing pinActive\n"); pinActive++; // Reset to zero if we're above the number of pins if (pinActive >= TOTAL_PINS) { printf("Resetting pinActive to zero\n"); pinActive = 0; } } // Turn on the next pin printf("Turning on pin %d\n", pinActive); pinOn(pinActive); } } snd_seq_free_event(ev); }
void FlashableWidget::reset() { oneByOneIndex_ = 0; vSelectedHalve_.clear(); vFirstHalve_.clear(); vSecondHalve_.clear(); allOff(); }
// Set digital output pins HVRelays::HVRelays() { pinMode(RELAY1, OUTPUT); pinMode(RELAY2, OUTPUT); pinMode(RELAY3, OUTPUT); pinMode(RELAY4, OUTPUT); pinMode(RELAY5, OUTPUT); pinMode(RELAY6, OUTPUT); allOff(); // Make sure everything is off to start }
void Flash() { // // Briefly flashes all the LEDs // allOn(); wait1Msec(150); allOff(); wait1Msec(150); }
bool OCGs::optContentIsVisible( Object *dictRef ) { Object dictObj; Dict *dict; Object dictType; Object ocg; Object policy; bool result = true; dictRef->fetch( m_xref, &dictObj ); if ( ! dictObj.isDict() ) { error(-1, "Unexpected oc reference target: %i", dictObj.getType() ); dictObj.free(); return result; } dict = dictObj.getDict(); // printf("checking if optContent is visible\n"); dict->lookup("Type", &dictType); if (dictType.isName("OCMD")) { // If we supported Visibility Expressions, we'd check // for a VE entry, and then call out to the parser here... // printf("found OCMD dict\n"); dict->lookup("P", &policy); dict->lookupNF("OCGs", &ocg); if (ocg.isArray()) { if (policy.isName("AllOn")) { result = allOn( ocg.getArray() ); } else if (policy.isName("AllOff")) { result = allOff( ocg.getArray() ); } else if (policy.isName("AnyOff")) { result = anyOff( ocg.getArray() ); } else if ( (!policy.isName()) || (policy.isName("AnyOn") ) ) { // this is the default result = anyOn( ocg.getArray() ); } } else if (ocg.isRef()) { OptionalContentGroup* oc = findOcgByRef( ocg.getRef() ); if ( !oc || oc->getState() == OptionalContentGroup::Off ) { result = false; } else { result = true ; } } ocg.free(); policy.free(); } else if ( dictType.isName("OCG") ) { OptionalContentGroup* oc = findOcgByRef( dictRef->getRef() ); if ( !oc || oc->getState() == OptionalContentGroup::Off ) { result=false; } } dictType.free(); dictObj.free(); // printf("visibility: %s\n", result? "on" : "off"); return result; }
void drawRight() { // // Seqeuentially turns on all the LEDs in a row with a brief delay between each // allOff(); for (nLED = LED8; nLED >= LED1; --nLED) { wait1Msec(100); SensorValue[nLED] = 1; } wait1Msec(400); }
//////////////////////////////////////////////////////////////////////////////// // Error LED Pattern void LED::error(){ allOff(); int d = 250; for(int i=0; i<=4; i++){ redToggle(HIGH); delay(d); redToggle(LOW); delay(d); } }
static void _heat_start(struct brew_task *bt) { allOff(); // kick off reading the temp vTaskEnterCritical(); DS1820Init(); DS1820Skip(); DS1820Convert(); vTaskExitCritical(); vTaskDelay(1000); vTaskEnterCritical(); DS1820ReadTemp(); vTaskExitCritical(); // make sure we have consistent readings on the level probes level_wait_for_steady_readings(); }
void LedsSimulator::setOffColor(QColor color) { m_offColor = color; allOff(); updateGL(); }
void FL7Dl::show(const int dig, int num) { if (_on) { PORTC &= ~(1<<dig); int n = 0; switch (dig) { case 3: PORTB |= _yellow << 2; n+=(_yellow)?250/delay:0; break; case 2: PORTB |= _green << 2; n+=(_green)? 250/delay :0; break; case 1: PORTB |= _ticker << 2; n+=(_ticker)? 250/delay :0; break; case 0: PORTB |= _alarm << 2; n+=(_alarm) ? 250/delay :0; break; } switch (num) { case 0: PORTD |= B11111000; PORTB |= B00000001; n += 6 * 250/delay; break; case 1: PORTD |= B00110000; n += 1 * 250/delay; break; case 2: PORTD |= B11011000; PORTB |= B00000010; n += 5 * 250/delay; break; case 3: PORTD |= B01111000; PORTB |= B00000010; n += 5 * 250/delay; break; case 4: PORTD |= B00110000; PORTB |= B00000011; n += 4 * 250/delay; break; case 5: PORTD |= B01101000; PORTB |= B00000011; n += 5 * 250/delay; break; case 6: PORTD |= B11101000; PORTB |= B00000011; n += 7 * 250/delay; break; case 7: PORTD |= B00111000; n += 3 * 250/delay; break; case 8: PORTD |= B11111000; PORTB |= B00000011; n += 7 * 250/delay; break; case 9: PORTD |= B01111000; PORTB |= B00000011; n += 6 * 250/delay; break; default: PORTB |= B00000010; n += 1 * 250/delay; break; } delayMicroseconds(n*delay/(5*500/delay)); allOff(); } }
void FL7Dl::showString(char * str) { char str2[4] = {0xFF, 0xFF, 0xFF, 0xFF}; switch (strlen(str)) { case 4: str2[0] = str[3]; case 3: str2[1] = str[2]; case 2: str2[2] = str[1]; case 1: str2[3] = str[0]; break; } for (int i = 3; i >= 0; i--) { PORTC &= ~(1<<i); switch (str2[3-i]) { case 'a': PORTD |= B10111000; PORTB |= B00000011; break; case 'b': PORTD |= B11100000; PORTB |= B00000011; break; case 'c': PORTD |= B11000000; PORTB |= B00000010; break; case 'd': PORTD |= B11110000; PORTB |= B00000010; break; case 'e': PORTD |= B11001000; PORTB |= B00000011; break; case 'f': PORTD |= B10001000; PORTB |= B00000011; break; case 'g': PORTD |= B01111000; PORTB |= B00000011; break; case 'h': PORTD |= B10100000; PORTB |= B00000011; break; case 'i': PORTD |= B00100000; break; case 'j': PORTD |= B11110000; break; case 'l': PORTD |= B11000000; PORTB |= B00000001; break; case 'n': PORTD |= B10100000; PORTB |= B00000010; break; case 'o': PORTD |= B11100000; PORTB |= B00000010; break; case 'p': PORTD |= B10011000; PORTB |= B00000011; break; case 'q': PORTD |= B00111000; PORTB |= B00000011; break; case 'r': PORTD |= B10000000; PORTB |= B00000010; break; case 's': PORTD |= B01101000; PORTB |= B00000011; break; case 't': PORTD |= B11000000; PORTB |= B00000011; break; case 'u': PORTD |= B11110000; PORTB |= B00000001; break; case 'v': PORTD |= B11100000; break; case 'y': PORTD |= B01110000; PORTB |= B00000011; break; case 'z': PORTD |= B11011000; PORTB |= B00000010; break; case 0xFF: allOff(); default: PORTB |= B00000010; break; } delayMicroseconds(delay); allOff(); } }
void _heat_stop(struct brew_task *bt) { allOff(); }