void setup(){
pwmSetup();
}
void loop(){
int Duty = 128;//type in the voltage you want. Refer to guide on limiting comonents
OCR2A = Duty;
}
void pwmSetup(){//just run once at setup
pinMode(11, OUTPUT); //OCR2A
TCCR2A = _BV(COM2A1) | _BV(COM2B1) | _BV(WGM20); //phase correct pwm 31250hz
TCCR2B = _BV(CS20);//change this as datasheet says to mainly get different pwm frequencies
OCR2A = 0;
OCR2B = 0;
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น