ÿþ #include "avr/io.h" #define ENABLE 0 #define MTR_1 1 #define MTR_2 2 #define SW (PINA&0x80) int main ( ) { DDRA = 0x7F; DDRB = 0xFF; PORTB = PORTB & (~(1<<ENABLE)); PORTB = PORTB & (~(1<<MTR_1)); PORTB = PORTB & (~(1<<MTR_2)); while (1) { PORTB = PORTB | (1<<ENABLE); if(SW == 1) { PORTB = PORTB | (1<<MTR_1); PORTB = PORTB & (~(1<<MTR_2)); } else{ PORTB = PORTB & (~(1<<MTR_1)); PORTB = PORTB | (1<<MTR_2); } } return 0; }