Advertisement
ivosexa

servo

Oct 23rd, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #define F_CPU 1000000UL
  2. #include <avr/io.h>
  3. #include <util/delay.h>
  4. int main(void)
  5. {
  6. DDRB |= 1<<
  7. TCCR1A |= 1<<WGM11 | 1<<COM1A1 ;
  8. TCCR1B |= 1<<WGM13 | 1<<WGM12 | 1<<CS10;
  9. ICR1 = 19999;
  10.  
  11.  
  12.  
  13.  
  14.  
  15. while (1)
  16. {
  17.  
  18.  
  19. OCR1A =700;
  20. _delay_ms(700);
  21.  
  22.  
  23.  
  24. OCR1A =900;
  25. _delay_ms(700);
  26.  
  27.  
  28.  
  29. OCR1A =1100;
  30. _delay_ms(700);
  31.  
  32.  
  33.  
  34. OCR1A =1250;
  35. _delay_ms(700);
  36.  
  37.  
  38.  
  39. OCR1A =1500;
  40. _delay_ms(700);
  41.  
  42.  
  43.  
  44. OCR1A =1700;
  45. _delay_ms(700);
  46.  
  47.  
  48.  
  49. OCR1A =1900;
  50. _delay_ms(700);
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement