Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. // I christian cook did this on my own and did not copy anyone elses work
  2.  
  3.  
  4. /*
  5. * btn_hold_main2.c.c
  6. *
  7. * Created: 10/9/2019 3:06:47 PM
  8. * Author : ccook4
  9. */
  10.  
  11. #include <avr/io.h>
  12. #define F_CPU 16000000 // need to tell delay.h the CPU frequency
  13. #include <util/delay.h> // needed for _delay_ms() routines
  14.  
  15.  
  16. int main(void)
  17. {
  18.  
  19. DDRC = DDRC & 0b11000111;
  20. PORTC = PORTC | 0b00111000;
  21. PORTB = PORTB | 0b00011110;
  22. DDRB = 0b00011110;
  23.  
  24. /* Replace with your application code */
  25. while (1)
  26. {
  27.  
  28. if(PINC ==( PINC & 0b11011111))
  29. {
  30. PORTB = 0b00010111;
  31. }
  32. else
  33. {
  34. PORTB = 0b00011110;
  35. }
  36. if(PINC ==(PINC & 0b11101111))
  37. {
  38. PORTB = 0b00011011;
  39. }
  40. else
  41. {
  42. PORTB = 0b00011110;
  43. }
  44. if(PINC ==( PINC & 0b11110111))
  45. {
  46. PORTB = 0b00011101;
  47. }
  48. else
  49. {
  50. PORTB = 0b00011111;
  51. }
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement