Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. #include <avr/io.h>
  2. #include <avr/delay.h>
  3.  
  4.  
  5. #define F_CPU 1000000UL
  6.  
  7. int main(void)
  8. {
  9. PORTA = 0b00000000;
  10. DDRA = 0xFF;
  11. // for(int i = 8; i >= 0 ; i--)
  12. // {
  13. // PORTA += (1 << i);
  14. // _delay_ms(1000);
  15. // }
  16. //
  17. // for(int i = 0; i <= 8 ; i++)
  18. // {
  19. // PORTA -= (1 << i);
  20. // _delay_ms(1000);
  21. // }
  22.  
  23.  
  24.  
  25. // for(int i = 3 ; i >= 0 ; i--)
  26. // {
  27. // PORTA += (1 << i);
  28. // _delay_ms(1000);
  29. // }
  30.  
  31. // for(int i = 0 ; i <= 3 ; i++)
  32. // {
  33. // PORTA -= (1 << i);
  34. // _delay_ms(1000);
  35. // }
  36. //
  37. // for(int i = 4 ; i <= 8 ; i++)
  38. // {
  39. // PORTA += (1 << i);
  40. // _delay_ms(1000);
  41. // }
  42. //
  43. // for(int i = 8 ; i >= 4 ; i--)
  44. // {
  45. // PORTA -= (1 << i);
  46. // _delay_ms(1000);
  47. // }
  48.  
  49. for(int i = 8 ; i >= 4 ; i--)
  50. {
  51. PORTA += (1 << i);
  52. _delay_ms(1000);
  53. }
  54.  
  55. for(int i = 4 ; i <= 8 ; i++)
  56. {
  57. PORTA -= (1 << i);
  58. _delay_ms(1000);
  59. }
  60.  
  61. for(int i = 0 ; i <= 3 ; i++)
  62. {
  63. PORTA += (1 << i);
  64. _delay_ms(1000);
  65. }
  66.  
  67. for(int i = 3 ; i >= 0 ; i--)
  68. {
  69. PORTA -= (1 << i);
  70. _delay_ms(1000);
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement