Advertisement
ktostam450

[ARDUINO] PWM

May 7th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.30 KB | None | 0 0
  1. #include <avr/io.h>
  2. #include <avr/interrupt.h>
  3.  
  4. int main (void)
  5. {
  6.     DDRD |= _BV(6);
  7.     OCR0A = 16; //PWM speed (percentage)
  8.    
  9.     //TCCR0B |= _BV(CS00) | _BV(CS02);   prescaler 1024
  10.     TCCR0B |= _BV(CS01); //prescaler 8
  11.     TCCR0A |= _BV(WGM00) | _BV(WGM01) | _BV(COM0A1);
  12.    
  13.     for (;;);
  14.     return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement