Advertisement
duovis224

Untitled

Dec 4th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. /*
  2. * blink1.c
  3. */
  4.  
  5. #include <avr/io.h>
  6. #include <avr/interrupt.h>
  7.  
  8.  
  9.  
  10. int main(void)
  11. {
  12. DDRC|=(<<PC5); //OUT LED
  13. DDRC|=(<<PC4); //OUT LED
  14. DDRB &=~(1<<PB1); //IN
  15. DDRB &=~(1<<PB2); //IN
  16.  
  17. while(1)
  18. {
  19. if (PORTB &(1<<PB1)==1); //nuspaustas PORTB1 mygtukas
  20. {
  21. PORTC |=(1<<PC5); //LED on
  22. delay_ms(3000); //3s
  23. PORTC &=~(1<<PC5); //LED off
  24.  
  25. }
  26. }
  27. if (PORTB &(1<<PB2)==1); //nuspaustas PORTB2 mygtukas
  28. {
  29. PORTC |=(1<<PC4); //LED on
  30. delay_ms(6000); //6s
  31. PORTC &=~(1<<PC4); //LED off
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement