plugin23

2

Feb 10th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. /*
  2.  * firsttry.c
  3.  *
  4.  * Created: 17.9.2015 11:15:25
  5.  * Author: d14valicek
  6.  * Rozsvietit LEDku na PB1
  7.  */
  8.  
  9. #define F_CPU 1000000UL
  10. #include <avr/io.h>
  11. #include <util/delay.h>
  12. #include <math.h>
  13.  
  14. int main(void)
  15. {
  16.     DDRD = 0xFF;
  17.     while(1)
  18.     {
  19.         for (int c = 1; c <=256; c=c*2)
  20.         {
  21.             PORTD = ~c;
  22.             _delay_ms(100);
  23.         }
  24.         for (int c = 256; c >=1; c=c/2) //hod zacina 0; pyta sa ci je hod mensia ako 256; hod + 1
  25.         {
  26.             PORTD = ~c;
  27.             _delay_ms(100);
  28.         }
  29.     }
  30.    
  31.     return 0;
  32. }
Add Comment
Please, Sign In to add comment