plugin23

3

Feb 10th, 2016
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. /*
  2.  * zadanie3.c
  3.  *
  4.  * Created: 22.10.2015 11:45:17
  5.  *  Author: d14valicek
  6.  */
  7.  
  8. #define F_CPU 1000000UL
  9. #include <avr/io.h>
  10. #include <util/delay.h>
  11.  
  12. int main(void)
  13. {
  14.     DDRD = 0xFF;
  15.     while(1)
  16.     {
  17.         for(int c = 1; c <= 256; c=(c*2))
  18.         {
  19.             int a = c - 1;
  20.             PORTD =~a;
  21.             _delay_ms(500);
  22.         }
  23.    
  24.         for(int c = 256; c >= 1; c=(c/2))
  25.         {
  26.             int a = c - 1;
  27.             PORTD = ~a;
  28.             _delay_ms(500);
  29.         }
  30.     }
  31.    
  32.     return 0;
  33. }
Add Comment
Please, Sign In to add comment