Advertisement
KgCro

L07Zneki

Nov 26th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1.  
  2. #define F_CPU 7372800UL // UL -> unsigned long - frekvencija CPU-a
  3.  
  4. #include <avr/io.h>
  5. #include <util/delay.h>
  6.  
  7. void blink(void){
  8.     PORTA ^= _BV(3);
  9. }
  10.  
  11. int main(){
  12.    
  13.     DDRA = _BV(3);
  14.     PORTA = _BV(3);
  15.    
  16.     PORTB = _BV(0);
  17.     DDRB = 0;
  18.    
  19.     while (1){
  20.         if(bit_is_clear(PINB,0)){
  21.             blink();
  22.         }
  23.        
  24.         _delay_ms(200);
  25.        
  26.     }
  27.    
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement