#include void secDelay(int count){ int i; for(;count>0;count--){ for(i=1000; i>0;i--){ i--; } } } void tenthSecDelay(int count){ int i; for (;count>0; count--){ for(i=100; i>0;i--){ i--; } } } int main(){ DDRD = 0x00; // make D all input; adjusts wait until power-on PORTD = 0xFF; DDRB = 0xC0; // 1100 0000; makes PB7, PB6 output and the rest input PORTB = 0x3F; // engage pullup on first six bits while (1) { PORTB = 0x40; secDelay(100); // delay at beginning PORTB = 0x80; secDelay(100); // PORTB = 0x40; /* PORTB = 0x80; // 1000 0000; makes PB7 = !Q = On, PB6 = Q = Off int tenthSecOff = PIND; int tenthSecOn = PINB; tenthSecDelay(tenthSecOff); //tenthSecDelay(tenthDelay); if (tenthSecOn > 0) { // PB6 is Q, PB7 is !Q PORTB = 0x40; // 0100 0000 //secDelay(secsOn); //tenthSecDelay(tenthsOn); tenthSecDelay(tenthSecOn); PORTB = 0x80; // 1000 0000 break; // turn on !Q, turn off Q, die } else { PORTB = 0x40; // must be infinitely on break; // goes to next infinite while which is dead } */ } while (1) { } return 0; }