/******************************************************************************** Includes ********************************************************************************/ #include #include /******************************************************************************** Main ********************************************************************************/ int main(void) { // configure PORTA as output DDRA = 0xFF; // configure PORTB as input DDRB = 0; // make sure PORTB is high impedance and will not source PORTB = 0; // main loop while (true) { if (~PINB & (1 << PB0)) { // turn on every other light on PORTA, inverse logic PORTA = 0xAA; } else if (~PINB & (1 << PB1)) { // turn on the lower 4 lights light on PORTA, inverse logic PORTA = 0xF0; } else { // default case, all lights off on PORTA, inverse logic PORTA = 0xFF; } } }