You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Should this be merged into the library? Normally you'd send a pull request for that?
This code appears to have the actual pin numbers, rather than TIMER1_A_PIN, TIMER1_B_PIN, TIMER1_C_PIN. Was it actually tested with this version of TimerOne? Older versions were hard-coded for only AVR, and only certain AVR chips but not others.
Hi
Firstly,Thanks for your project!
I noticed that, when i want to setpwmduty to 0, it makes dutycycle %100.
I editted your library like that;
void TimerOne::setPwmDuty(char pin, int duty)
{
unsigned long dutyCycle = pwmPeriod;
dutyCycle *= duty;
dutyCycle >>= 10;
if( duty<=0) //newly added line both protection and prevent 0 dutycycle error.
dutyCycle=1;
oldSREG = SREG;
cli();
if(pin == 1 || pin == 9) OCR1A = dutyCycle;
else if(pin == 2 || pin == 10) OCR1B = dutyCycle;
Serial.print(dutyCycle);
SREG = oldSREG;
}
The text was updated successfully, but these errors were encountered: