Advertisement
mikolajmki

mikro_lab2

Apr 12th, 2022
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #ifndef F_CPU
  2. #define F_CPU 1000000UL
  3. #endif
  4. #include <avr/io.h>
  5. #include <util/delay.h>
  6.  
  7.  
  8. int main(void)
  9. {
  10.     DDRA |= 0xFF;
  11.     DDRB &= 0xFE;
  12.    
  13.     PORTB = 0x01;
  14.  
  15.     while(1)
  16.     {  
  17.         while ((PINB & (1<<PB0)))
  18.         {
  19.             PORTA = 0x00;
  20.         }
  21.        
  22.         while (!(PINB & (1<<PB0)))
  23.         {
  24.             PORTA ^= 0x01;
  25.             _delay_ms(30);
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement