1. #ifndef F_CPU
2. #define F_CPU 8000000
3. #endif
4. 
5. #include <avr/io.h>
6. #include <util/delay.h>
7. 
8. //-------------------------------------
9. void m_delay_10ms(unsigned char val) {
10. //-------------------------------------
11. //a _delay_ms max 65.535 ms-et képes sleepelni,
12. // tehát nagyobb időzítést többből lehet "összerakni"
13.     unsigned char i;
14.     for(i=0;i<val;i++) {
15.         _delay_ms(10);
16.     }
17. }
18. 
19. //-------------------------------------
20. int main(void) {
21. //-------------------------------------
22.     DDRB = (1<<PINB3)|(<<PINB4); //csak a PB3 és a PB4 kimenet
23.     PORTB = 0x00;    //mindent kikapcsol
24.     while(1) {
25.         if(PORTB & (1<<PINB3)) PORTB |= ~(1<<PINB3);
26.                           else PORTB &=  (1<<PINB3);
27.         if(PORTB & (1<<PINB4)) PORTB |= ~(1<<PINB4);
28.                           else PORTB &=  (1<<PINB4);
29.         m_delay_10ms(100); //100*10ms = 1s
30.      }
31.    
32.      return 0;
33.  }