Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. /*
  2. * sk.c
  3. *
  4. * Created on: Feb 17, 2019
  5. * Author: students
  6. */
  7. #include <avr/io.h>
  8. #include <avr/delay.h>
  9.  
  10. #define F_CPU 16000000UL
  11.  
  12. int main(void)
  13. {
  14. DDRD &= ~_BV(DDD5); //Set as input
  15. DDRB |= _BV(DDB5); // set as output
  16. PORTB= 0x00;
  17.  
  18. while(1)
  19. {
  20. if(bit_is_clear(PIND,PIND5))
  21. {
  22. PORTB|= _BV(PORTB5);
  23.  
  24. }
  25. else
  26. {
  27. PORTB &= ~_BV(PORTB5);
  28. }
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement