Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <avr/io.h>
  2. #include <util/delay.h>
  3. #include <avr/io.h>
  4. #include <avr/pgmspace.h>
  5. #include <util/delay.h>
  6. #include <util/crc16.h>
  7. #include <stdio.h>
  8. #include <stdbool.h>
  9. int main (void)
  10. {
  11. DDRB = 0xFF;
  12. DDRC = 0xFF;
  13. DDRD = 0xFF;
  14. int i = 0;
  15. bool c = 0;
  16. while(1)
  17. {
  18.  
  19. switch(c)
  20. {
  21. case 0:
  22. PORTB |= 1 << i;
  23. // PORTD |= 1 << i;
  24. break;
  25. case 1:
  26. PORTC |= 1 << i;
  27. break;
  28. }
  29. _delay_ms(4000);
  30. if( i == 8 )
  31. {
  32. c = !c;
  33. i = -1;
  34. }
  35. ++i;
  36. PORTD = 0b00000000;
  37. PORTB = 0b00000000;
  38. PORTC = 0b00000000;
  39. }
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement